[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Can full userdata be put back on the stack?
- From: Benoit Germain <bgermain@...>
- Date: Wed, 11 Dec 2002 16:36:41 +0100
> Say I were to do this, what function would I call to put the
> address on the
> lua stack? Is it lua_pushlightuserdata? This has the correct signature
> (putting a void* on the stack, and lua_newuserdata returns
> void*) but it
> seems incorrect to push full userdata with lua_pushlightuserdata.
Indeed. This is because pushing a light userdata is like pushing a number,
whereas pushing a full userdata with lua_newuserdata allocates memory and
pushes a lua object that references it. So, when you have a full userdata
somewhere and want some function to use the memory area, you have to either
push the light userdata of the corresponding address, or your must retreive
the full userdata itself by some means.