diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-09-09 17:14:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-09 17:14:35 -0400 |
commit | 0c451a60b7fe859f9deeaefb6360e96ec9af630f (patch) | |
tree | 6c1bfbbef656b818f026a371136d345e88a41c71 /indra/newview/scripts/lua | |
parent | 04568da18d2261f3f7b851cf5341b766c9648204 (diff) | |
parent | 0c42147fabaef31a2c577fc009dec354447c2e7f (diff) |
Merge pull request #2523 from secondlife/lua-feature-flag
Put viewer's Lua functionality behind a feature flag, default off.
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r-- | indra/newview/scripts/lua/auto/menus.lua | 51 | ||||
-rw-r--r-- | indra/newview/scripts/lua/require/UI.lua | 4 |
2 files changed, 53 insertions, 2 deletions
diff --git a/indra/newview/scripts/lua/auto/menus.lua b/indra/newview/scripts/lua/auto/menus.lua new file mode 100644 index 0000000000..b2f54d83df --- /dev/null +++ b/indra/newview/scripts/lua/auto/menus.lua @@ -0,0 +1,51 @@ +-- Inject Lua-related menus into the top menu structure. Run this as a Lua +-- script so that turning off the Lua feature also disables these menus. + +-- Under Develop -> Consoles, want to present the equivalent of: +-- <menu_item_separator/> +-- <menu_item_check +-- label="LUA Debug Console" +-- name="LUA Debug Console"> +-- <menu_item_check.on_check +-- function="Floater.Visible" +-- parameter="lua_debug" /> +-- <menu_item_check.on_click +-- function="Floater.Toggle" +-- parameter="lua_debug" /> +-- </menu_item_check> +-- <menu_item_check +-- label="LUA Scripts Info" +-- name="LUA Scripts"> +-- <menu_item_check.on_check +-- function="Floater.Visible" +-- parameter="lua_scripts" /> +-- <menu_item_check.on_click +-- function="Floater.Toggle" +-- parameter="lua_scripts" /> +-- </menu_item_check> + +local startup = require 'startup' +local UI = require 'UI' + +-- Don't mess with the viewer's menu structure until we've logged in. +startup.wait('STATE_STARTED') + +-- Add LUA Debug Console to Develop->Consoles +local pos = 9 +UI.addMenuSeparator{ + parent_menu='Consoles', pos=pos, +} +pos += 1 +UI.addMenuItem{ + parent_menu='Consoles', pos=pos, + name='lua_debug', label='LUA Debug Console', + func='Floater.ToggleOrBringToFront', param='lua_debug', +} +pos += 1 + +-- Add LUA Scripts Info to Develop->Consoles +UI.addMenuItem{ + parent_menu='Consoles', pos=pos, + name='lua_scripts', label='LUA Scripts Info', + func='Floater.ToggleOrBringToFront', param='lua_scripts', +} diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 73a76fa6b8..cf2695917e 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -170,13 +170,13 @@ end -- see UI.callables() for valid values of 'func' function UI.addMenuItem(...) - local args = mapargs('name,label,parent_menu,func,param', ...) + local args = mapargs('name,label,parent_menu,func,param,pos', ...) args.op = 'addMenuItem' return leap.request('UI', args) end function UI.addMenuSeparator(...) - local args = mapargs('parent_menu', ...) + local args = mapargs('parent_menu,pos', ...) args.op = 'addMenuSeparator' return leap.request('UI', args) end |