aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/LSLGuiMess.lua39
1 files changed, 17 insertions, 22 deletions
diff --git a/lib/LSLGuiMess.lua b/lib/LSLGuiMess.lua
index 7cab046..4f2fffe 100644
--- a/lib/LSLGuiMess.lua
+++ b/lib/LSLGuiMess.lua
@@ -31,33 +31,28 @@ llSetTouchText(string text)
31--[[ llDialog(key id, string message, list buttons, integer chat_channel) 31--[[ llDialog(key id, string message, list buttons, integer chat_channel)
32 http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog 32 http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog
33]] 33]]
34llDialog = function (id, message, buttons, channel) 34 llDialog = function (id, message, buttons, channel)
35 local win = skang.window(200, 25 + 25 * #buttons, message, 'llDialogWindow') 35 local win = skang.window(200, 25 + 25 * #buttons, message, 'llDialogWindow')
36 36
37print('llDialog(' .. id .. ', ' .. message .. ', , ' .. channel .. ')') 37 for i, v in ipairs(buttons) do
38skang.printTableStart(buttons, '', 'buttons') 38 skang.thingasm{win, 'button' .. i, 'Selects button ' .. i, types = 'widget', widget='"button", "' .. v .. '", 10, ' .. (25 * i) .. ', 60, 25'}
39 39 win.W['button' .. i].action = 'purkle.say(' .. channel .. ', "onefang Rejected", "' .. id .. '", "' .. v .. '")'
40 for i, v in ipairs(buttons) do 40 end
41 skang.thingasm{win, 'button' .. i, 'Selects button ' .. i, types = 'widget', widget='"button", "' .. v .. '", 10, ' .. (25 * i) .. ', 60, 25'}
42 win.W['button' .. i].action = 'purkle.say(' .. channel .. ', "onefang Rejected", "' .. id .. '", "' .. v .. '")'
43 end 41 end
44 42
45end
46
47 43
48local doLua = function (command) 44 local doLua = function (command)
49 -- Yes I know, it hurt my brain just writing this. lol 45 -- Yes I know, it hurt my brain just writing this. lol
50 -- It just swaps square brackets for curly ones, coz LSL uses [] to surround lists, and Lua uses {} to surround tables. 46 -- It just swaps square brackets for curly ones, coz LSL uses [] to surround lists, and Lua uses {} to surround tables.
51 local c, err = loadstring(string.gsub(command, '[%[%]]', {['['] = '{', [']'] = '}'})) 47 local c, err = loadstring(string.gsub(command, '[%[%]]', {['['] = '{', [']'] = '}'}))
52 if c then 48 if c then
53 setfenv(c, _M) 49 setfenv(c, _M)
54 c() 50 c()
55 else 51 else
56 print("ERROR - " .. err) 52 print("ERROR - " .. err)
53 end
57 end 54 end
58 55 skang.thingasm('doLua', 'Run a Lua command.', doLua, 'string')
59end
60skang.thingasm('doLua', 'Run a Lua command.', doLua, 'string')
61 56
62 skang.moduleEnd(_M) 57 skang.moduleEnd(_M)
63end 58end