lua-users home
lua-l archive

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


Michael Broughton wrote:
You suggest that it is not a good idea to combine the metatable and method table for userdata. Is performance the only reason?

Sorry if I have been confusing terminology in my emails. I always combine the metatable and method table in my libraries. The third party Lua libraries I've looked at do this as well. So do the examples in PIL2.


Yes, I know it's common.

My distaste for it comes more from a desire for writing safe modules
than performance considerations. I think this thread demonstrates the
safety issues involved in conflating the two tables. However, once
you decide (if you do) to separate the metamethod and method tables,
you are certainly free to take advantage of resulting efficiencies :)

Fortunately, Lua is flexible enough to encompass both solutions, and
a variety of other ones.