diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-06-19 10:10:53 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-06-19 10:10:53 -0400 |
commit | 165b3cb04266f96f7fc48f542f915b93a4795aaf (patch) | |
tree | af4def3999858ea126d66225b111de2039ee3f2b /indra/newview/scripts/lua/require | |
parent | ef596c44fce4a1059b8d79aff1c73db5ce628169 (diff) |
Move popup.lua to require subdir with the rest of the modules.
Diffstat (limited to 'indra/newview/scripts/lua/require')
-rw-r--r-- | indra/newview/scripts/lua/require/popup.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/require/popup.lua b/indra/newview/scripts/lua/require/popup.lua new file mode 100644 index 0000000000..8a01ab7836 --- /dev/null +++ b/indra/newview/scripts/lua/require/popup.lua @@ -0,0 +1,32 @@ +local leap = require 'leap' + +-- notification is any name defined in notifications.xml as +-- <notification name=> +-- vars is a table providing values for [VAR] substitution keys in the +-- notification body. +local popup_meta = { + -- setting this function as getmetatable(popup).__call() means this gets + -- called when a consumer calls popup(notification, vars, payload) + __call = function(self, notification, vars, payload) + return leap.request('LLNotifications', + {op='requestAdd', name=notification, + substitutions=vars, + payload=payload}) + end +} + +local popup = setmetatable({}, popup_meta) + +function popup:alert(message) + return self('GenericAlert', {MESSAGE=message}) +end + +function popup:alertOK(message) + return self('GenericAlertOK', {MESSAGE=message}) +end + +function popup:alertYesCancel(message) + return self('GenericAlertYesCancel', {MESSAGE=message}) +end + +return popup |