On Mon, Jul 26, 2004 at 08:17:20AM -0700, Mark Hamburg wrote:
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
You can do something rather similar that works with multiple
inheritance by checking something like:
luaObj.metatable[ pushlightuserdata(classInfo) ] == true
-- Jamie Webb