From 67f822eeb04229c06b42297675cfa53bdcb414de Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 27 Mar 2014 00:00:54 +1000 Subject: No need to pass module to skang.thing(), it can work it out. --- ClientHamr/GuiLua/skang.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'ClientHamr/GuiLua/skang.lua') 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 -- required - "boolean" to say if this thing is required. TODO - Maybe fold this into types somehow, or acl? -- acl - Access Control List defining security restrains. -- boss - the Thing or person that owns this Thing, otherwise it is self owned. -thing = function (module, names, help, default, types, widget, required, acl, boss) +thing = function (names, help, default, types, widget, required, acl, boss) + -- Grad the environment of the calling function, so this new thing automatically becomes a global in it. + module = getfenv(2) + -- Break out the names. local n = {} local i = 1 @@ -382,12 +385,12 @@ end quit = function () end -thing(_M, 'nada', 'Do nothing.', nada) -thing(_M, 'clear', 'The current skin is cleared of all widgets.', clear) -thing(_M, 'window', 'The size and title of the application Frame.', window, 'x,y,name', nil, nil, 'GGG') -thing(_M, 'module', 'Load a module.', module, 'file,acl') -thing(_M, 'skang', 'Parse the contents of a skang file or URL.', skang, 'URL') -thing(_M, 'quit', 'Quit, exit, remove thyself.', quit) +thing('nada', 'Do nothing.', nada) +thing('clear', 'The current skin is cleared of all widgets.', clear) +thing('window', 'The size and title of the application Frame.', window, 'x,y,name', nil, nil, 'GGG') +thing('module', 'Load a module.', module, 'file,acl') +thing('skang', 'Parse the contents of a skang file or URL.', skang, 'URL') +thing('quit', 'Quit, exit, remove thyself.', quit) moduleEnd(_M) -- cgit v1.1