|
|
||
|
....
I have code like this:
local fruit = { sort = "mango", type = "ripe", taste = "smooth" }
local ashes = "oz"
class = { new = new, repr = repr, fruit = fruit, -- TABLE ref ashes = ashes -- STRING ref }
....
-- lua first looks for a "fruit" element in o1 - doesn't find one.o1.ashes = "england" -- assign string to o1.ashes o1.fruit.sort = "banana" -- modifies shared (by metatable) "fruit" table
if you said
o1.fruit = {}
then o1 would have it's own fruit table, and
o1.fruit.sort = "banana"
would have the expected efect.Adrian