lua-users home
lua-l archive

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

On Aug 7, 2005, at 19:08:25, Mike Pall wrote:
Uli Kusterer wrote:
Looking at the
sources, I get the impression that luaL_checkudata() returns NULL for
subclasses of the requested type. Is there a facility to do the
equivalent of luaL_checkudata() but also look at metatables higher

I have contributed a small patch for Lua 5.1 that adds support
for subclasses to luaL_checkudata() and luaL_newmetatable().
It's in the mailing list archives:


thanks, that looks nice. If I understand correctly, this still requires me to specify the methods completely for each class, though? In that case I'll probably stick with an unpatched version for now and check manually. That way, it's *all* manual, and it's obvious they're separate classes. Otherwise, this half-class-hierarchy will only confuse me when I come back to the code after a hiatus. :-S

But thank you for pointing me at your code: It provides a great insight into the workings of that part of Lua, and could be a great starting point for a real implementation of multiple inheritance for userdata-based objects in Lua.

-- M. Uli Kusterer