lua-users home
lua-l archive

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


> Yes. lua_close systematically deletes every allocated object, calling gc
> methods if defined. However, in this case you cannot rely on the order of
> collection to guarantee that gc methods will be called in the order you
> think is logical. (The order is logical, but it might not accord with your
> idea of your data, so it is unwise to count on this.) In particular, there
> is no way to guarantee that objects will be garbage collected before
> anything they reference has been garbage collected. There is no way to do
> this because there might be circular references.

A small correction: You can assume that, among udata being collected in
the same cycle, their GC metamethods are called in reverse order of
their creation. That is valid during lua_close, too.

-- Roberto