lua-users home
lua-l archive

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


> If I have a weak ref to a user data (as a value) in a table, is it
> possible for the weak ref to be removed long before the userdata's
> __gc metamethod is called? Does this happen in multiple passes of the
> collector?

No. The weak reference should be cleared before the _gc metamethod is
called. (If the userdata is a key instead of a value, then it is
removed only after running the _gc metamethod.)

-- Roberto