|
On Apr 11, 2007, at 9:49 AM, Luiz Henrique de Figueiredo wrote:
How's this code shrinking the array? The objects referred to will be recycled if you use luaL_unref and it's the only reference, but luaL_unref builds a linked list out of recycled indices right inside the registry array, so the array cannot shrink, as far as I can tell. LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { if (ref >= 0) { t = abs_index(L, t); lua_rawgeti(L, t, FREELIST_REF); lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ lua_pushinteger(L, ref); lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ } } Gé -- Gé Weijers |