summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2024-05-02 16:58:37 +0300
committerGitHub <noreply@github.com>2024-05-02 16:58:37 +0300
commit51e86a0eff4e919075b32c498305add577450111 (patch)
tree4334ec60cadf7aefddf8266c21731b38592aa583 /indra/newview/scripts/lua
parent6d860672ec3e05660844a40c56b8644130a1f6b6 (diff)
parentf9a2748b542d05d153fa591a8c452162d9402828 (diff)
Merge pull request #1352 from secondlife/lua-change-debug-setting
Allow changing debug settings via Lua script
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r--indra/newview/scripts/lua/LLDebugSettings.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua
new file mode 100644
index 0000000000..c809dfff91
--- /dev/null
+++ b/indra/newview/scripts/lua/LLDebugSettings.lua
@@ -0,0 +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)
+ check_response(leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value}))
+end
+
+function LLDebugSettings.toggle(name)
+ check_response(leap.request('LLViewerControl', {op='toggle', group='Global', key=name}))
+end
+
+function LLDebugSettings.get(name)
+ return check_response(leap.request('LLViewerControl', {op='get', group='Global', key=name}))['value']
+end
+
+return LLDebugSettings