aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-03-20 14:40:10 +1000
committerDavid Walter Seikel2014-03-20 14:40:10 +1000
commit19a7dce868539141b4d2f2ab9e14a787cdff0c0f (patch)
treea1c793e8f8775378d2952cae1a076b19a79a9f98 /ClientHamr
parentAdded boss and acl arguments for params and commands, and filled in more for ... (diff)
downloadSledjHamr-19a7dce868539141b4d2f2ab9e14a787cdff0c0f.zip
SledjHamr-19a7dce868539141b4d2f2ab9e14a787cdff0c0f.tar.gz
SledjHamr-19a7dce868539141b4d2f2ab9e14a787cdff0c0f.tar.bz2
SledjHamr-19a7dce868539141b4d2f2ab9e14a787cdff0c0f.tar.xz
TODO++
Diffstat (limited to 'ClientHamr')
-rw-r--r--ClientHamr/GuiLua/skang.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index ec8a496..23615ae 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -64,8 +64,10 @@ local skangModuleBegin = function (name, author, copyright, version, timestamp,
64 _M._M = _M -- So that references to _M below the setfenv() actually go to the real _M. 64 _M._M = _M -- So that references to _M below the setfenv() actually go to the real _M.
65 _M._PACKAGE = string.gsub(_M._NAME, "[^.]*$", "") -- Strip the name down to the package name. 65 _M._PACKAGE = string.gsub(_M._NAME, "[^.]*$", "") -- Strip the name down to the package name.
66 66
67 -- TODO - Should parse in an entire copyright message, and strip that down into bits, to put back together.
67 _M.AUTHOR = author 68 _M.AUTHOR = author
68 _M.COPYRIGHT = copyright .. ' ' .. author 69 _M.COPYRIGHT = copyright .. ' ' .. author
70 -- TODO - Translate the version number into a version string.
69 _M.VERSION = version .. ' lookup version here ' .. timestamp 71 _M.VERSION = version .. ' lookup version here ' .. timestamp
70 -- TODO - If there's no skin passed in, try to find the file skin .. '.skang' and load that instead. 72 -- TODO - If there's no skin passed in, try to find the file skin .. '.skang' and load that instead.
71 _M.DEFAULT_SKANG = skin 73 _M.DEFAULT_SKANG = skin
@@ -136,17 +138,29 @@ moduleBegin = function (name, author, copyright, version, timestamp, skin)
136end 138end
137 139
138 140
141--[[
142Thing = {}
143Thing.__index = Thing -- So this can be used as the metatable for Things.
144So in newParam and newCommand -
145 setmetatable(module, Thing)
146]]
147
148
149
139-- skang.newParam stashes the default value into _M['bar'], and the details into ThingSpace.parameters['bar']. 150-- skang.newParam stashes the default value into _M['bar'], and the details into ThingSpace.parameters['bar'].
140-- Actually, if it's not required, and there's no default, then skip setting _M['bar']. 151-- Actually, if it's not required, and there's no default, then skip setting _M['bar'].
141-- Could even use _index to skip setting it if it's not required and there is a default. 152-- Could even use _index to skip setting it if it's not required and there is a default.
142-- Also should add a metatable, and __newindex() that passes all setting of this variable to skang so it can update other stuff like linked widgets. 153-- Also should add a metatable, and __newindex() that passes all setting of this variable to skang so it can update other stuff like linked widgets.
154-- TODO - If it's not required, and there's no default, then skip setting _M['bar'].
155-- TODO - Could even use __index to skip setting it if it's not required and there is a default.
156-- TODO - Should add a metatable, and __newindex() that passes all setting of this variable to skang so it can update other stuff like linked widgets.
143-- TODO - Users might want to use two or more copies of this module. Keep that in mind. local a = require 'test', b = require 'test' might handle that though? 157-- TODO - Users might want to use two or more copies of this module. Keep that in mind. local a = require 'test', b = require 'test' might handle that though?
144-- Not unless skang.newParam() knows about a and b, which it wont. 158-- Not unless skang.newParam() knows about a and b, which it wont.
145-- Both a and b get the same table, not different copies of it. 159-- Both a and b get the same table, not different copies of it.
146-- Perhaps clone the table if it exists? There is no Lua table cloner, would have to write one. Only clone the parameters, the rest can be linked back to the original. 160-- Perhaps clone the table if it exists? There is no Lua table cloner, would have to write one. Only clone the parameters, the rest can be linked back to the original.
147-- Then we have to deal with widgets linking to specific clones. 161-- Then we have to deal with widgets linking to specific clones.
148-- Actually, not sure matrix-RAD solved that either. lol 162-- Actually, not sure matrix-RAD solved that either. lol
149-- This could even be done with an array of these arguments, not including the _M. 163-- TODO - This could even be done with an array of these arguments, not including the _M.
150newParam = function (module, name, required, shortcut, default, help, acl, boss) 164newParam = function (module, name, required, shortcut, default, help, acl, boss)
151 module[name] = default 165 module[name] = default
152 ThingSpace.parameters[name] = {module = module, name = name, required = required, shortcut = shortcut, default = default, help = help, acl = acl, boss = boss, } 166 ThingSpace.parameters[name] = {module = module, name = name, required = required, shortcut = shortcut, default = default, help = help, acl = acl, boss = boss, }
@@ -154,7 +168,7 @@ newParam = function (module, name, required, shortcut, default, help, acl, boss)
154end 168end
155 169
156-- skang.newCommand stashes the function into _M['func'], and stashes it all (including the function) into ThingSpace.commands['func']. 170-- skang.newCommand stashes the function into _M['func'], and stashes it all (including the function) into ThingSpace.commands['func'].
157-- TODO - Could use _call so that ThingSpace.commands['foo'](arg) works. 171-- TODO - Could use __call so that ThingSpace.commands['foo'](arg) works.
158newCommand = function (module, name, types, help, func, acl, boss) 172newCommand = function (module, name, types, help, func, acl, boss)
159 module[name] = func 173 module[name] = func
160 ThingSpace.commands[name] = {module = module, name = name, help = help, func = func, acl = acl, boss = boss, } 174 ThingSpace.commands[name] = {module = module, name = name, help = help, func = func, acl = acl, boss = boss, }