lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


just to check I'm not overlooking some obvious point. It's certainly trivial, but sometimes I need to be sure.

* Say an "object"'s metatable __index field points to a "type". The object will not "inherit" the type's metatable (eg the __tostring field). Meaning print(object) will not use the func pointed by the type's metatable __tostring field. We need to transmit the whole of the type's metatable to instance objects.

* The only way to transmit a metatable is to explicitely set the original table's one to the new table. (setmetatable(t2, getmetatable(t1)).


la vita e estrany