|
On 26/08/2011 16.31, Stefan Reich wrote:
Ah. Thanks for the feedback on that! I am going for a simpler solution as of now, which is just to test for presence of a metatable. When I create Lua objects these days, I am lazy and just put the methods in the table directly. I don't know if it was smarter to do it any other way, but it's convenient and it works. Probably memory efficiency would be the main reason to collect things in common metatables, right?
I'm not an expert of Lua internals, but I read somewhere that IIRC there is also a cache for metatables. Thus adding methods to individual objects may also impact performance. Not sure though.
Cheers, Stefan
-- Lorenzo