From 0809e748eb6d6d6da25806cd01c512463d059960 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Fri, 16 May 2014 19:05:01 +1000 Subject: For llDialog(), add a simple implementation to LSLGuiMess, and call it badly from extantz. Still trying to debug this. --- lib/LSLGuiMess.lua | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'lib') 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 local skang = require 'skang' -- This module has no default skin, it creates windows as needed. local _M = skang.moduleBegin('LSLGuiMess', nil, 'Copyright 2014 David Seikel', '0.1', '2014-05-16 11:07:00') + local purkle = require 'purkle' ---[[ TODO - -llDialog(key id, string message, list buttons, integer chat_channel) - http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog +--[[ TODO - llTextBox() http://wiki.secondlife.com/wiki/LlTextBox @@ -26,6 +25,38 @@ llSetTouchText(string text) ]] - skang.moduleEnd(_M) + + +--[[ llDialog(key id, string message, list buttons, integer chat_channel) + http://lslwiki.net/lslwiki/wakka.php?wakka=llDialog +]] +llDialog = function (id, message, buttons, channel) + local win = skang.window(200, 25 + 25 * #buttons, message, 'llDialogWindow') + +print('llDialog(' .. id .. ', ' .. message .. ', , ' .. channel .. ')') +skang.printTableStart(buttons, '', 'buttons') + + for i, v in ipairs(buttons) do + skang.thingasm{win, 'button' .. i, 'Selects button ' .. i, types = 'widget', widget='"button", "' .. v .. '", 10, ' .. (25 * i) .. ', 60, 25'} + win.W['button' .. i].action = 'purkle.say(' .. channel .. ', "onefang Rejected", "' .. id .. '", "' .. v .. '")' + end + end + +local doLua = function (command) + -- Yes I know, it hurt my brain just writing this. lol + -- It just swaps square brackets for curly ones, coz LSL uses [] to surround lists, and Lua uses {} to surround tables. + local c, err = loadstring(string.gsub(command, '[%[%]]', {['['] = '{', [']'] = '}'})) + if c then + setfenv(c, _M) + c() + else + print("ERROR - " .. err) + end + +end +skang.thingasm('doLua', 'Run a Lua command.', doLua, 'string') + + skang.moduleEnd(_M) +end -- cgit v1.1