[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Best way to find out to what userdata is on the stack?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 13 Mar 2007 08:45:32 -0300
> This is a newbies question: If i create multiple userdata objects,
> what the best way to find out if that userdata pointer that i get from
> the stack belongs to my "Foobar" c struct.
> At the moment i'm using an hash table for all my own userdata,
> lookup the pointer there and if found i get a verification that this
> userdata is really a "Foobar" struct.
This is one way, yes. But I hope you're using a Lua table for that, not
your own hash table...
For another way, see http://www.lua.org/pil/28.html , especially section 28.2.