diff options
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index b1ed581..6cbec8c 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -438,8 +438,6 @@ local Mum = | |||
438 | { | 438 | { |
439 | __index = function (parent, key) | 439 | __index = function (parent, key) |
440 | -- This only works for keys that don't exist. By definition a value of nil means it doesn't exist. | 440 | -- This only works for keys that don't exist. By definition a value of nil means it doesn't exist. |
441 | -- TODO - Java skang called isValid() on get(). On the other hand, doesn't seem to call it on set(), but calls it on append(). | ||
442 | -- Ah, it was doing isValid() on setStufflet(). | ||
443 | 441 | ||
444 | -- First see if this is a Thing. | 442 | -- First see if this is a Thing. |
445 | local metaMum, thingy = getStuffed(parent, key) | 443 | local metaMum, thingy = getStuffed(parent, key) |
@@ -478,10 +476,13 @@ __newindex = function (parent, key, value) | |||
478 | if 'table' == type(oldValue) then | 476 | if 'table' == type(oldValue) then |
479 | oldMum = getmetatable(oldValue) | 477 | oldMum = getmetatable(oldValue) |
480 | if oldMum then | 478 | if oldMum then |
481 | -- TODO - This SHOULD work, but doesn't. | 479 | -- TODO - This SHOULD work, but doesn't - |
482 | --setmetatable(value, oldMum) | 480 | --setmetatable(value, oldMum) |
483 | -- Instead we do this - | 481 | -- Instead we do this - |
484 | -- TODO - This wont clear out any values in the old table that are not in the new table. Should it? | 482 | -- Clear out any values in the old table. |
483 | for k, v in pairs(oldMum.__values) do | ||
484 | oldMum.__values[k] = nil | ||
485 | end | ||
485 | for k, v in pairs(value) do | 486 | for k, v in pairs(value) do |
486 | local newK = oldMum.__self.stuff[k] | 487 | local newK = oldMum.__self.stuff[k] |
487 | if newK then newK = newK.names[1] else newK = k end | 488 | if newK then newK = newK.names[1] else newK = k end |
@@ -506,7 +507,7 @@ __newindex = function (parent, key, value) | |||
506 | end, | 507 | end, |
507 | 508 | ||
508 | __call = function (func, ...) | 509 | __call = function (func, ...) |
509 | return thingasm(func, ...) -- (func, {...}) | 510 | return thingasm(func, ...) |
510 | end, | 511 | end, |
511 | 512 | ||
512 | } | 513 | } |