From 56e4b8c5f637343c8a1a181fd59324e033b4782d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 21 Jun 2024 15:11:57 -0400 Subject: Exercise the simple popup.lua APIs --- indra/newview/scripts/lua/test_popup.lua | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 indra/newview/scripts/lua/test_popup.lua (limited to 'indra/newview/scripts/lua/test_popup.lua') diff --git a/indra/newview/scripts/lua/test_popup.lua b/indra/newview/scripts/lua/test_popup.lua new file mode 100644 index 0000000000..e48f89c3a7 --- /dev/null +++ b/indra/newview/scripts/lua/test_popup.lua @@ -0,0 +1,6 @@ +popup = require 'popup' + +response = popup:alert('This just has a Close button') +response = popup:alertOK(string.format('You said "%s", is that OK?', next(response))) +response = popup:alertYesCancel(string.format('You said "%s"', next(response))) +popup:tip(string.format('You said "%s"', next(response))) -- cgit v1.2.3 From a80b9487dc7c893f5e96f48f15140a5f82b99e30 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 23 Aug 2024 17:18:14 -0400 Subject: Allow UI to have lazily-loaded submodules. Equip UI with an __index metamethod. When someone references an unknown key/field in UI, require() that module and cache it for future reference. Add util.setmetamethods() as a way to find or create a metatable on a specified table containing specified metamethods. Exercise the new functionality by referencing UI.popup in test_popup.lua. --- indra/newview/scripts/lua/test_popup.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/scripts/lua/test_popup.lua') diff --git a/indra/newview/scripts/lua/test_popup.lua b/indra/newview/scripts/lua/test_popup.lua index e48f89c3a7..156c09c78f 100644 --- a/indra/newview/scripts/lua/test_popup.lua +++ b/indra/newview/scripts/lua/test_popup.lua @@ -1,4 +1,5 @@ -popup = require 'popup' +UI = require 'UI' +popup = UI.popup response = popup:alert('This just has a Close button') response = popup:alertOK(string.format('You said "%s", is that OK?', next(response))) -- cgit v1.2.3 From e6d8379744b08f9a52af6734ba1f0e1b50fb5906 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 23 Aug 2024 22:39:30 -0400 Subject: Massage results from UI.popup() for ease of use. In particular, where the raw leap.request().response call would return {OK_okcancelbuttons=true}, just return the string 'OK' or 'Cancel'. Update existing consumer scripts. --- indra/newview/scripts/lua/test_popup.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/scripts/lua/test_popup.lua') diff --git a/indra/newview/scripts/lua/test_popup.lua b/indra/newview/scripts/lua/test_popup.lua index 156c09c78f..7a11895669 100644 --- a/indra/newview/scripts/lua/test_popup.lua +++ b/indra/newview/scripts/lua/test_popup.lua @@ -1,7 +1,10 @@ UI = require 'UI' popup = UI.popup +startup = require 'startup' + +startup.wait('STATE_STARTED') response = popup:alert('This just has a Close button') -response = popup:alertOK(string.format('You said "%s", is that OK?', next(response))) -response = popup:alertYesCancel(string.format('You said "%s"', next(response))) -popup:tip(string.format('You said "%s"', next(response))) +response = popup:alertOK(string.format('You said "%s", is that OK?', response)) +response = popup:alertYesCancel(string.format('You said "%s"', response)) +popup:tip(string.format('You said "%s"', response)) -- cgit v1.2.3