|
On Apr 18, 2006, at 06:45, Adrian Sietsma wrote:
Will a userdata's address change when the gc runs ? ie: lua_pushstring(L,"foo"); p = lua_newuserdata(L,sizeof(foo)); lua_rawset(L,LUA_REGISTRYINDEX); ... do something to force a gc lua_pushstring(L,"foo"); lua_rawget(L,LUA_REGISTRYINDEX); p1 = lua_touserdata(L,-1); assert (p==p1); <----------------
The documentation doesn't say explicitly either way.I think the specification should be similar to the lua_tolstring case, the pointer returned will not be valid when the corresponding value is removed from the stack.
drj