lua-users home
lua-l archive

Re: File descriptors and local variables

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


On Tue, Nov 5, 2013 at 9:11 AM, Paul K <paulclinger@yahoo.com> wrote:
> when the handle is garbage collected after going out of scope, but
> does it go out of scope immediately (as it's not assigned to anything)
No such guarantee! It will be collected whenever Lua feels like doing
a collection - there is no concept of immediate finalization.
So in general, better to close the handle immediately and wrap it all
up in an exists() function.
(Deterministic finalization _would_ be a cool feature, and naturally
it has been discussed before)

AltStyle によって変換されたページ (->オリジナル) /