lua-users home
lua-l archive

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

>Is there a Lua 5 construction that allows userdata to be "typed" more simply than with metatables? If not, then is the most appropriate solution to put a numeric identifier in each object's metatable?

If you're using light userdata, then you can try to add an entry in the registry
or any other table whose key is the pointer and whose value is your notion of
type, say a simple numeric id. For ordinary user data, the metatable itself
identifies objects of the same "class".

>Quick aside: the new documentation for "lua_error" shows the old style prototype with string parameter.

Thanks. Will be fixed.

>Suggestion: I would like to see "lua_getn" made public again. It seems to me that many C programs use this, not just ltablib.c.

The n is no longer stored in tables (but can be): it's stored in a separate
table, indexed by the tables. This is an implementation decision of the table
library; it does not belong in the core of Lua. You can always call "getn"
using lua_call...