lua-users home
lua-l archive

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


If you can live with single-inheritance, my scheme using indices in the
metatable will work with the type-testing technique used in Oberon. Single
inheritance allows us to know that a class is at a particular depth in the
inheritance tree. The metatable for a class can then include the appropriate
light userdata for each class in its inheritance hierarchy. Testing for
class membership then becomes something like:

    luaObj.metatable[ classInfo->depth ] == classInfo

Mark