lua-users home
lua-l archive

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


> GC may collect any value which not referenced by some table (key or
> value).

That would be a bit harsh.  GC collects objects that or *not reachable*
(directly or indirectly) from a root set.  This root set is the C globals,
the registry and the stack.  There are many more ways to reference an object
than through tables: closure environments, upvalues, thread globals, thread
stack, ...

As long as an object is still on the stack a pointer to it obtained through
the Lua API remains valid.  This applies for example to lua_tothread and
lua_tostring.

--
Wim