[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: metatable transmission
- From: spir <denis.spir@...>
- Date: Mon, 7 Dec 2009 09:06:38 +0100
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