From 76d36fe7210443b4564d2646a2fe5aa6d7c490fc Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 29 Apr 2024 19:56:41 +0300 Subject: Allow getting the value of debug settings via Lua script --- indra/newview/scripts/lua/LLDebugSettings.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 indra/newview/scripts/lua/LLDebugSettings.lua (limited to 'indra/newview/scripts/lua') diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua new file mode 100644 index 0000000000..71a12a2ca2 --- /dev/null +++ b/indra/newview/scripts/lua/LLDebugSettings.lua @@ -0,0 +1,13 @@ +leap = require 'leap' + +local LLDebugSettings = {} + +function LLDebugSettings.set(name, value) + leap.send('LLAppViewer', {op='setDebugSetting', setting=name, value=value}) +end + +function LLDebugSettings.get(name) + return leap.request('LLAppViewer', {op='getDebugSetting', setting=name})['value'] +end + +return LLDebugSettings -- cgit v1.2.3 From 79dca07d790a47db192099bcb85e740676a643ee Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 1 May 2024 19:58:47 +0300 Subject: Use LLViewerControlListener to access debug settings --- indra/newview/scripts/lua/LLDebugSettings.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/scripts/lua') diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua index 71a12a2ca2..80ae7e87bb 100644 --- a/indra/newview/scripts/lua/LLDebugSettings.lua +++ b/indra/newview/scripts/lua/LLDebugSettings.lua @@ -3,11 +3,15 @@ leap = require 'leap' local LLDebugSettings = {} function LLDebugSettings.set(name, value) - leap.send('LLAppViewer', {op='setDebugSetting', setting=name, value=value}) + return leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value}) +end + +function LLDebugSettings.toggle(name) + return leap.request('LLViewerControl', {op='toggle', group='Global', key=name}) end function LLDebugSettings.get(name) - return leap.request('LLAppViewer', {op='getDebugSetting', setting=name})['value'] + return leap.request('LLViewerControl', {op='get', group='Global', key=name})['value'] end return LLDebugSettings -- cgit v1.2.3 From f9a2748b542d05d153fa591a8c452162d9402828 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 2 May 2024 14:03:34 +0300 Subject: Raise Lua error if LLViewerControlListener response contains one --- indra/newview/scripts/lua/LLDebugSettings.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/newview/scripts/lua') diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua index 80ae7e87bb..c809dfff91 100644 --- a/indra/newview/scripts/lua/LLDebugSettings.lua +++ b/indra/newview/scripts/lua/LLDebugSettings.lua @@ -1,17 +1,24 @@ leap = require 'leap' +function check_response(res) + if res.error then + error(res.error) + end + return res +end + local LLDebugSettings = {} function LLDebugSettings.set(name, value) - return leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value}) + check_response(leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value})) end function LLDebugSettings.toggle(name) - return leap.request('LLViewerControl', {op='toggle', group='Global', key=name}) + check_response(leap.request('LLViewerControl', {op='toggle', group='Global', key=name})) end function LLDebugSettings.get(name) - return leap.request('LLViewerControl', {op='get', group='Global', key=name})['value'] + return check_response(leap.request('LLViewerControl', {op='get', group='Global', key=name}))['value'] end return LLDebugSettings -- cgit v1.2.3