From eb82c78b071d71a0fd2d7be1c573997e41bab51e Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 6 Aug 2024 20:38:06 +0300 Subject: code clean up --- indra/newview/scripts/lua/require/UI.lua | 8 ++++---- indra/newview/scripts/lua/test_toolbars.lua | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/scripts/lua') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index df76b1501c..9bc9a3685d 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -177,8 +177,8 @@ end -- Toolbar buttons -- *************************************************************************** -- Clears all buttons off the toolbars -function UI.clearToolbars() - leap.send('UI', {op='clearToolbars'}) +function UI.clearAllToolbars() + leap.send('UI', {op='clearAllToolbars'}) end function UI.defaultToolbars() @@ -186,8 +186,8 @@ function UI.defaultToolbars() end -- UI.addToolbarBtn{btn_name=btn_name --- [, toolbar= 3] -- 1 [TOOLBAR_LEFT], 2 [TOOLBAR_RIGHT], 3 [TOOLBAR_BOTTOM] --- [, rank=1]} -- position on the toolbar +-- [, toolbar= bottom] -- left, right, bottom -- default is bottom +-- [, rank=1]} -- position on the toolbar, starts at 0 (0 - first position, 1 - second position etc.) function UI.addToolbarBtn(...) local args = mapargs('btn_name,toolbar,rank', ...) args.op = 'addToolbarBtn' diff --git a/indra/newview/scripts/lua/test_toolbars.lua b/indra/newview/scripts/lua/test_toolbars.lua index 70035db775..9a832c5644 100644 --- a/indra/newview/scripts/lua/test_toolbars.lua +++ b/indra/newview/scripts/lua/test_toolbars.lua @@ -3,16 +3,17 @@ UI = require 'UI' local OK = 'OK_okcancelbuttons' local BUTTONS = UI.getToolbarBtnNames() +local TOOLBARS = {'left','right','bottom'} -- Clear the toolbars and then add the toolbar buttons to the random toolbar response = popup:alertYesCancel('Toolbars will be randomly reshuffled. Proceed?') if next(response) == OK then - UI.clearToolbars() + UI.clearAllToolbars() math.randomseed(os.time()) -- add the buttons to the random toolbar for i = 1, #BUTTONS do - UI.addToolbarBtn(BUTTONS[i], math.random(3)) + UI.addToolbarBtn(BUTTONS[i], TOOLBARS[math.random(3)]) end -- remove some of the added buttons from the toolbars -- cgit v1.2.3