aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/skang.lua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-04-01 23:08:59 +1000
committerDavid Walter Seikel2014-04-01 23:08:59 +1000
commit628987e1151d9b1639377e2dfb87b2810c8efd4c (patch)
treefd09dfac2356be917e325e69dfdfb3a04567d307 /ClientHamr/GuiLua/skang.lua
parentSeparate out the metatable __ stuff from Thing, put it into Mum. (diff)
downloadSledjHamr-628987e1151d9b1639377e2dfb87b2810c8efd4c.zip
SledjHamr-628987e1151d9b1639377e2dfb87b2810c8efd4c.tar.gz
SledjHamr-628987e1151d9b1639377e2dfb87b2810c8efd4c.tar.bz2
SledjHamr-628987e1151d9b1639377e2dfb87b2810c8efd4c.tar.xz
valueMeta -> oldMum, plus some comments.
Diffstat (limited to 'ClientHamr/GuiLua/skang.lua')
-rw-r--r--ClientHamr/GuiLua/skang.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index de0a0af..24f3dbc 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -572,24 +572,28 @@ __newindex = function (parent, key, value)
572 572
573 if thingy then 573 if thingy then
574 local name = thingy.names[1] 574 local name = thingy.names[1]
575 local valueMeta 575 local oldMum
576 576
577 if 'table' == type(value) then 577 if 'table' == type(value) then
578 -- Coz setting it via metaMum screws with the __index stuff somehow. 578 -- Coz setting it via metaMum screws with the __index stuff somehow.
579 local oldValue = metaMum.__values[name] 579 local oldValue = metaMum.__values[name]
580 if 'table' == type(oldValue) then 580 if 'table' == type(oldValue) then
581 valueMeta = getmetatable(oldValue) 581 oldMum = getmetatable(oldValue)
582 if valueMeta then 582 if oldMum then
583 -- TODO - This SHOULD work, but doesn't.
584 --setmetatable(value, oldMum)
585 -- Instead we do this -
583 -- TODO - This wont clear out any values in the old table that are not in the new table. Should it? 586 -- TODO - This wont clear out any values in the old table that are not in the new table. Should it?
584 for k, v in pairs(value) do 587 for k, v in pairs(value) do
585 local newK = valueMeta.__self.stuff[k] 588 local newK = oldMum.__self.stuff[k]
586 if newK then newK = newK.names[1] else newK = k end 589 if newK then newK = newK.names[1] else newK = k end
587 valueMeta.__values[newK] = v 590 oldMum.__values[newK] = v
588 end 591 end
592
589 end 593 end
590 end 594 end
591 end 595 end
592 if nil == valueMeta then metaMum.__values[name] = value end 596 if nil == oldMum then metaMum.__values[name] = value end
593 -- NOTE - invalid values are still stored, this is by design. 597 -- NOTE - invalid values are still stored, this is by design.
594 if not thingy:isValid(parent) then 598 if not thingy:isValid(parent) then
595 for i, v in ipairs(thingy.errors) do 599 for i, v in ipairs(thingy.errors) do