diff options
Diffstat (limited to '')
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 20 |
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 | ||
527 | end | 526 | end |
528 | 527 | ||
529 | Thing.__newindex = function (parent, key, value) | 528 | Thing.__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. |
535 | print('__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 |
544 | print('__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] |