aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-03-27 00:00:54 +1000
committerDavid Walter Seikel2014-03-27 00:00:54 +1000
commit67f822eeb04229c06b42297675cfa53bdcb414de (patch)
tree6b32a4cf4df1791ea13d2e5b9522c01bb48d12c8 /ClientHamr/GuiLua
parentMore Stuff notes. (diff)
downloadSledjHamr-67f822eeb04229c06b42297675cfa53bdcb414de.zip
SledjHamr-67f822eeb04229c06b42297675cfa53bdcb414de.tar.gz
SledjHamr-67f822eeb04229c06b42297675cfa53bdcb414de.tar.bz2
SledjHamr-67f822eeb04229c06b42297675cfa53bdcb414de.tar.xz
No need to pass module to skang.thing(), it can work it out.
Diffstat (limited to 'ClientHamr/GuiLua')
-rw-r--r--ClientHamr/GuiLua/skang.lua17
-rw-r--r--ClientHamr/GuiLua/test.lua7
2 files changed, 14 insertions, 10 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index e81c598..adf4edf 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -304,7 +304,10 @@ end
304-- required - "boolean" to say if this thing is required. TODO - Maybe fold this into types somehow, or acl? 304-- required - "boolean" to say if this thing is required. TODO - Maybe fold this into types somehow, or acl?
305-- acl - Access Control List defining security restrains. 305-- acl - Access Control List defining security restrains.
306-- boss - the Thing or person that owns this Thing, otherwise it is self owned. 306-- boss - the Thing or person that owns this Thing, otherwise it is self owned.
307thing = function (module, names, help, default, types, widget, required, acl, boss) 307thing = function (names, help, default, types, widget, required, acl, boss)
308 -- Grad the environment of the calling function, so this new thing automatically becomes a global in it.
309 module = getfenv(2)
310
308 -- Break out the names. 311 -- Break out the names.
309 local n = {} 312 local n = {}
310 local i = 1 313 local i = 1
@@ -382,12 +385,12 @@ end
382quit = function () 385quit = function ()
383end 386end
384 387
385thing(_M, 'nada', 'Do nothing.', nada) 388thing('nada', 'Do nothing.', nada)
386thing(_M, 'clear', 'The current skin is cleared of all widgets.', clear) 389thing('clear', 'The current skin is cleared of all widgets.', clear)
387thing(_M, 'window', 'The size and title of the application Frame.', window, 'x,y,name', nil, nil, 'GGG') 390thing('window', 'The size and title of the application Frame.', window, 'x,y,name', nil, nil, 'GGG')
388thing(_M, 'module', 'Load a module.', module, 'file,acl') 391thing('module', 'Load a module.', module, 'file,acl')
389thing(_M, 'skang', 'Parse the contents of a skang file or URL.', skang, 'URL') 392thing('skang', 'Parse the contents of a skang file or URL.', skang, 'URL')
390thing(_M, 'quit', 'Quit, exit, remove thyself.', quit) 393thing('quit', 'Quit, exit, remove thyself.', quit)
391 394
392 395
393moduleEnd(_M) 396moduleEnd(_M)
diff --git a/ClientHamr/GuiLua/test.lua b/ClientHamr/GuiLua/test.lua
index 6a38cde..5a5fda1 100644
--- a/ClientHamr/GuiLua/test.lua
+++ b/ClientHamr/GuiLua/test.lua
@@ -30,11 +30,12 @@ print('code')
30-- A variable that is private to this module. 30-- A variable that is private to this module.
31local foo 31local foo
32 32
33skang.thing(_M, 'fooble,f', 'Help text goes here', 1, 'number', '"edit", "The fooble:", 1, 1, 10, 50', true) 33skang.thing('fooble,f', 'Help text goes here', 1, 'number', '"edit", "The fooble:", 1, 1, 10, 50', true)
34skang.thing(_M, 'bar', 'Help text', "Default") 34skang.thing('bar', 'Help text', "Default")
35skang.thing('foo')
35 36
36-- We can use inline functions if we don't need the function internally. 37-- We can use inline functions if we don't need the function internally.
37skang.thing(_M, 'ffunc', 'Help Text', function (arg1, arg2) 38skang.thing('ffunc', 'Help Text', function (arg1, arg2)
38 print('Inside test.ffunc ' .. arg1 .. ', ' .. arg2) 39 print('Inside test.ffunc ' .. arg1 .. ', ' .. arg2)
39end, 'number,string') 40end, 'number,string')
40 41