userdata and the gc
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: userdata and the gc
- From: Adrian Sietsma <adrian_groups@...>
- Date: 2006年4月18日 15:45:51 +1000
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