lua-users home
lua-l archive

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


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); <----------------

Adrian