aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr
diff options
context:
space:
mode:
Diffstat (limited to 'ClientHamr')
-rw-r--r--ClientHamr/GuiLua/skang.lua23
1 files changed, 5 insertions, 18 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index 3825f47..d79deff 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -199,13 +199,6 @@ Thing =
199 -- First see if this is a Thing. 199 -- First see if this is a Thing.
200 if thing then return thing.default end 200 if thing then return thing.default end
201 201
202 -- Look up aliases. Very slow, but uses less memory. Would only need to be done if an alias is used, and they are mostly for shortcuts.
203 for k, thing in pairs(ThingSpace.things) do
204 for i, v in ipairs(thing.names) do
205 if v == key then return table[ thing.names[1] ] end
206 end
207 end
208
209 -- If all else fails, return nil. 202 -- If all else fails, return nil.
210 return nil 203 return nil
211 end, 204 end,
@@ -213,16 +206,6 @@ Thing =
213 __newindex = function (table, key, value) 206 __newindex = function (table, key, value)
214 local thing = ThingSpace.things[key] 207 local thing = ThingSpace.things[key]
215 208
216 -- NOTE - This is really slow when setting stuff that is in the module that is NOT a Thing. Wont scale well.
217 if not thing then
218 -- Look up aliases. Very slow, but uses less memory. Would only need to be done if an alias is used, and they are mostly for shortcuts.
219 for k, thng in pairs(ThingSpace.things) do
220 for i, v in ipairs(thng.names) do
221 if v == key then thing = thng; break end
222 end
223 end
224 end
225
226 -- NOTE - A Thing is either a command or a parameter, not both. 209 -- NOTE - A Thing is either a command or a parameter, not both.
227 if thing then 210 if thing then
228 if 'function' == type(value) then 211 if 'function' == type(value) then
@@ -344,7 +327,11 @@ thing = function (module, names, help, default, types, widget, required, acl, bo
344 327
345 -- Set it all up. 328 -- Set it all up.
346 -- TODO - might want to merge into pre existing Thing instead of over writing like this. 329 -- TODO - might want to merge into pre existing Thing instead of over writing like this.
347 ThingSpace.things[name] = {module = module, names = n, help = help, default = default, types = t, widget = widget, required = required, acl = acl, boss = boss, } 330 local thing = {module = module, names = n, help = help, default = default, types = t, widget = widget, required = required, acl = acl, boss = boss, }
331 -- Stash the Thing under all of it's names.
332 for i, v in ipairs(thing.names) do
333 ThingSpace.things[v] = thing
334 end
348 -- This triggers the Thing.__newindex metamethod above. 335 -- This triggers the Thing.__newindex metamethod above.
349 module[name] = default 336 module[name] = default
350end 337end