diff options
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index c9a58ff..f88ff1c 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -237,15 +237,8 @@ Thing.hasCrashed = 0 -- How many times this Thing has crashed. | |||
237 | Thing.__index = function (table, key) | 237 | Thing.__index = function (table, key) |
238 | -- This only works for keys that don't exist. By definition a value of nil means it doesn't exist. | 238 | -- This only works for keys that don't exist. By definition a value of nil means it doesn't exist. |
239 | local thing = things[key] | 239 | local thing = things[key] |
240 | |||
241 | -- First see if this is a Thing. | 240 | -- First see if this is a Thing. |
242 | if thing then | 241 | if thing then return thing.value or thing.default end |
243 | local result = nil | ||
244 | if key ~= thing.names[1] then | ||
245 | result = table[thing.names[1] ] -- This might be recursive. | ||
246 | end | ||
247 | return result or thing.default | ||
248 | end | ||
249 | 242 | ||
250 | -- Then see if we can inherit it from Thing. | 243 | -- Then see if we can inherit it from Thing. |
251 | thing = Thing[key] | 244 | thing = Thing[key] |
@@ -256,11 +249,13 @@ Thing.__index = function (table, key) | |||
256 | end | 249 | end |
257 | 250 | ||
258 | Thing.__newindex = function (table, key, value) | 251 | Thing.__newindex = function (table, key, value) |
252 | -- This only works for keys that don't exist. By definition a value of nil means it doesn't exist. | ||
259 | local thing = things[key] | 253 | local thing = things[key] |
260 | 254 | ||
261 | if thing then | 255 | if thing then |
262 | local name = thing.names[1] | 256 | local name = thing.names[1] |
263 | rawset(table, name, value) -- Only stuff it under the first name, the rest are left as nil. | 257 | -- This is a proxy table, the values never exist in the real table. |
258 | thing.value = value | ||
264 | if 'function' == type(value) then | 259 | if 'function' == type(value) then |
265 | thing.func = value | 260 | thing.func = value |
266 | local types = '' | 261 | local types = '' |