aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-16 19:05:01 +1000
committerDavid Walter Seikel2014-05-16 19:05:01 +1000
commit0809e748eb6d6d6da25806cd01c512463d059960 (patch)
tree6aed0e687c785c3c47a4e5d4eb37cb2efafab649 /lib
parentAdd the purkle say() command. (diff)
downloadSledjHamr-0809e748eb6d6d6da25806cd01c512463d059960.zip
SledjHamr-0809e748eb6d6d6da25806cd01c512463d059960.tar.gz
SledjHamr-0809e748eb6d6d6da25806cd01c512463d059960.tar.bz2
SledjHamr-0809e748eb6d6d6da25806cd01c512463d059960.tar.xz
For llDialog(), add a simple implementation to LSLGuiMess, and call it badly from extantz.
Still trying to debug this.
Diffstat (limited to 'lib')
-rw-r--r--lib/LSLGuiMess.lua39
1 files changed, 35 insertions, 4 deletions
diff --git a/lib/LSLGuiMess.lua b/lib/LSLGuiMess.lua
index bc781ce..ff7538e 100644
--- a/lib/LSLGuiMess.lua
+++ b/lib/LSLGuiMess.lua
@@ -6,11 +6,10 @@ do
6 local skang = require 'skang' 6 local skang = require 'skang'
7 -- This module has no default skin, it creates windows as needed. 7 -- This module has no default skin, it creates windows as needed.
8 local _M = skang.moduleBegin('LSLGuiMess', nil, 'Copyright 2014 David Seikel', '0.1', '2014-05-16 11:07:00') 8 local _M = skang.moduleBegin('LSLGuiMess', nil, 'Copyright 2014 David Seikel', '0.1', '2014-05-16 11:07:00')
9 local purkle = require 'purkle'
9 10
10--[[ TODO -
11 11
12llDialog(key id, string message, list buttons, integer chat_channel) 12--[[ TODO -
13 http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog
14 13
15llTextBox() 14llTextBox()
16 http://wiki.secondlife.com/wiki/LlTextBox 15 http://wiki.secondlife.com/wiki/LlTextBox
@@ -26,6 +25,38 @@ llSetTouchText(string text)
26 25
27]] 26]]
28 27
29 skang.moduleEnd(_M) 28
29
30--[[ llDialog(key id, string message, list buttons, integer chat_channel)
31 http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog
32]]
33llDialog = function (id, message, buttons, channel)
34 local win = skang.window(200, 25 + 25 * #buttons, message, 'llDialogWindow')
35
36print('llDialog(' .. id .. ', ' .. message .. ', , ' .. channel .. ')')
37skang.printTableStart(buttons, '', 'buttons')
38
39 for i, v in ipairs(buttons) do
40 skang.thingasm{win, 'button' .. i, 'Selects button ' .. i, types = 'widget', widget='"button", "' .. v .. '", 10, ' .. (25 * i) .. ', 60, 25'}
41 win.W['button' .. i].action = 'purkle.say(' .. channel .. ', "onefang Rejected", "' .. id .. '", "' .. v .. '")'
42 end
43
30end 44end
31 45
46
47local doLua = function (command)
48 -- Yes I know, it hurt my brain just writing this. lol
49 -- It just swaps square brackets for curly ones, coz LSL uses [] to surround lists, and Lua uses {} to surround tables.
50 local c, err = loadstring(string.gsub(command, '[%[%]]', {['['] = '{', [']'] = '}'}))
51 if c then
52 setfenv(c, _M)
53 c()
54 else
55 print("ERROR - " .. err)
56 end
57
58end
59skang.thingasm('doLua', 'Run a Lua command.', doLua, 'string')
60
61 skang.moduleEnd(_M)
62end