[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5 and tags
- From: Vincent Penne <ziggy@...>
- Date: Sun, 25 Jul 2004 01:02:16 +0200
Alex Sandro Queiroz e Silva wrote:
Hallo,
You can say two objects (userdata or tables) are of the same type
if they share the same metatable. If want to refer to your types by
name, you can create entries in the global namespace using the type
name as a key and the metatable as a value. I guess luaL_newmetatable
and luaL_getmetatable do just that.
Ok, I see the idea. I was not aware of these luaL functions, this is
what I'm going to need. There is even a luaL_checkudata which does
exactly what I want, that is checking the type of my userdata.
You can't associate metatables with light userdata, but they are
useful in other contexts. The I/O standard library stores FILE*
pointers in light user data.
Ok ... I can certainly see some use for them, but I suppose you have to
be careful.
Now that Programming in Lua is online (http://www.lua.org/pil/),
it's definitely a excellent read for anyone studying Lua.
I will ! Thanks for the answer.
Vincent Penne.