diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-09-24 07:28:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 07:28:44 -0400 |
commit | 1175288a3c685310dbbf7fdd46d7deae0b0bf92d (patch) | |
tree | 84fd4d186169807c4da1c0c352d9be92f1e63227 /indra/newview/scripts/lua/test_toolbars.lua | |
parent | 0ee1106faccf90c883d8b9ffc522a341659742ed (diff) | |
parent | 9036e4582cec1893016bd692293ec1c0135f7112 (diff) |
Merge pull request #2534 from secondlife/release/luau-scripting
Add Lua scripting to develop, behind feature flag
Diffstat (limited to 'indra/newview/scripts/lua/test_toolbars.lua')
-rw-r--r-- | indra/newview/scripts/lua/test_toolbars.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/test_toolbars.lua b/indra/newview/scripts/lua/test_toolbars.lua new file mode 100644 index 0000000000..7683fca8a3 --- /dev/null +++ b/indra/newview/scripts/lua/test_toolbars.lua @@ -0,0 +1,26 @@ +UI = require 'UI' + +local BUTTONS = UI.getToolbarBtnNames() +local TOOLBARS = {'left','right','bottom'} + +-- Clear the toolbars and then add the toolbar buttons to the random toolbar +response = UI.popup:alertYesCancel('Toolbars will be randomly reshuffled. Proceed?') +if response == 'OK' then + UI.clearAllToolbars() + math.randomseed(os.time()) + + -- add the buttons to the random toolbar + for i = 1, #BUTTONS do + UI.addToolbarBtn(BUTTONS[i], TOOLBARS[math.random(3)]) + end + + -- remove some of the added buttons from the toolbars + for i = 1, #BUTTONS do + if math.random(100) < 30 then + UI.removeToolbarBtn(BUTTONS[i]) + end + end + popup:tip('Toolbars were reshuffled') +else + popup:tip('Canceled') +end |