lua-users home
lua-l archive

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


> Or do you just rely on the errors that arise when non-existant table
> entries are accessed?

That's what I do in my libraries. I have never felt the need to test
the type of udata in Lua. There's not much you can with udata in Lua,
except calling methods on them, and then you'll have type checking
done in C (or at least somewhere down the road).

If you really need to check types in Lua, you can redefine "type" in
Lua itself to look into special fields or tables. For instance, you
could create a key-weak table that maps udata to types and update it
every time you create a udata object.
--lhf