aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/skang.lua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-04-01 19:44:35 +1000
committerDavid Walter Seikel2014-04-01 19:44:35 +1000
commit087d3691376ae46cbcf6a5ce5d0681359e034d25 (patch)
tree348aa6d74460bc1cf80af00178ae5c57a8fdc3a0 /ClientHamr/GuiLua/skang.lua
parentImplement Stuff, and module -> parent, plus some clean ups. (diff)
downloadSledjHamr-087d3691376ae46cbcf6a5ce5d0681359e034d25.zip
SledjHamr-087d3691376ae46cbcf6a5ce5d0681359e034d25.tar.gz
SledjHamr-087d3691376ae46cbcf6a5ce5d0681359e034d25.tar.bz2
SledjHamr-087d3691376ae46cbcf6a5ce5d0681359e034d25.tar.xz
Fix up setting Stuff, mostly.
Still broken somewhere, but working better than it did before. Third time's the (unlucky) charm.
Diffstat (limited to 'ClientHamr/GuiLua/skang.lua')
-rw-r--r--ClientHamr/GuiLua/skang.lua20
1 files changed, 6 insertions, 14 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index 51e69f2..0a9752b 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -522,8 +522,7 @@ Thing.__index = function (parent, key)
522 end 522 end
523 523
524 -- Then see if we can inherit it from Thing. 524 -- Then see if we can inherit it from Thing.
525 thingy = Thing[key] 525 return Thing[key]
526 return thingy
527end 526end
528 527
529Thing.__newindex = function (parent, key, value) 528Thing.__newindex = function (parent, key, value)
@@ -532,8 +531,6 @@ Thing.__newindex = function (parent, key, value)
532 531
533 if mumThing and mumThing.self then 532 if mumThing and mumThing.self then
534 -- This is a proxy table, the values never exist in the real table. In theory. 533 -- This is a proxy table, the values never exist in the real table. In theory.
535print('__newindex ' .. mumThing.names[1] .. ' = ' .. key)
536--printTableStart(mumThing, '', 'mumThing')
537 534
538 -- Find the Thing and get it done. 535 -- Find the Thing and get it done.
539 local thingy = mumThing.self.stuff[key] 536 local thingy = mumThing.self.stuff[key]
@@ -541,14 +538,11 @@ print('__newindex ' .. mumThing.names[1] .. ' = ' .. key)
541 if not thingy then 538 if not thingy then
542 -- Deal with setting a new Stuff[key]. 539 -- Deal with setting a new Stuff[key].
543 if mumThing.self.isStuff and (nil == mumThing.__values[key]) then 540 if mumThing.self.isStuff and (nil == mumThing.__values[key]) then
544print('__newindex NEW stufflet ' .. key) 541 local newThing = copy(parent, key)
545 rawset(mumThing.__values, key, copy(parent, key)) 542 rawset(mumThing.__values, key, newThing)
546--printTableStart(getmetatable(parent).self, '', 'parent thing') 543 thingy = {names={key}, types={'table'}, parent=newThing, stuff=getmetatable(newThing).self.stuff, }
547--printTableStart(mumThing.__values[key], '', 'stufflet') 544 setmetatable(thingy, {__index = Thing}) -- To pick up isValid, pattern, and the other stuff by default.
548--printTableStart(getmetatable(mumThing.__values[key]), '', 'stufflet metatable?') 545 mumThing.self.stuff[key] = thingy
549--printTableStart(getmetatable(mumThing.__values[key]).self, '', 'stufflet thing?')
550 mumThing.self.stuff[key] = {names={key}, types={'table'}, parent=mumThing.__values[key], stuff=getmetatable(mumThing.__values[key]).self, }
551
552 end 546 end
553 end 547 end
554 548
@@ -556,8 +550,6 @@ print('__newindex NEW stufflet ' .. key)
556 local name = thingy.names[1] 550 local name = thingy.names[1]
557 local valueMeta 551 local valueMeta
558 552
559--printTableStart(thingy, '', 'thingy')
560
561 if 'table' == type(value) then 553 if 'table' == type(value) then
562 -- Coz setting it via mumThing screws with the __index stuff somehow. 554 -- Coz setting it via mumThing screws with the __index stuff somehow.
563 local oldValue = mumThing.__values[name] 555 local oldValue = mumThing.__values[name]