diff options
author | David Walter Seikel | 2014-05-16 19:05:01 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-16 19:05:01 +1000 |
commit | 0809e748eb6d6d6da25806cd01c512463d059960 (patch) | |
tree | 6aed0e687c785c3c47a4e5d4eb37cb2efafab649 /lib | |
parent | Add the purkle say() command. (diff) | |
download | SledjHamr-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 '')
-rw-r--r-- | lib/LSLGuiMess.lua | 39 |
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 | ||
12 | llDialog(key id, string message, list buttons, integer chat_channel) | 12 | --[[ TODO - |
13 | http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog | ||
14 | 13 | ||
15 | llTextBox() | 14 | llTextBox() |
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 | ]] | ||
33 | llDialog = function (id, message, buttons, channel) | ||
34 | local win = skang.window(200, 25 + 25 * #buttons, message, 'llDialogWindow') | ||
35 | |||
36 | print('llDialog(' .. id .. ', ' .. message .. ', , ' .. channel .. ')') | ||
37 | skang.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 | |||
30 | end | 44 | end |
31 | 45 | ||
46 | |||
47 | local 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 | |||
58 | end | ||
59 | skang.thingasm('doLua', 'Run a Lua command.', doLua, 'string') | ||
60 | |||
61 | skang.moduleEnd(_M) | ||
62 | end | ||