lua-users home
lua-l archive

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


Hi there,

I am currently writing an object system for lua (yes, another one). I
want to be able to define the metamethods like __add in my classes as
methods. This works pretty well the way I do it now (define all
metamethods in a metatable, and make them see wether the class defines
a method for that), but considering that the presence of metamethods
is checked for when evaluating expressions, I'd much rather have
another metatable for the metatable, which defines an __index method
that does the right thing[tm]. However, this does not seem to work.
So my question is, can a table that is used as a metatable have its
own metatable, and is that used?

thanks for any insight,

Gunnar