lua-users home
lua-l archive

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


Le Mon 14/01/2008 à 13:25 Luiz Henrique de Figueiredo à écrit:
> > My understanding was that Lua closed files at program end time.
> 
> Yes, because C closes all open files when a program ends normally.
> However, it's recommended that you close all files yourself to guard
> against crashes or bad compilers.
> 

Isn't this because lua closes the file when it's garbage collected, and
that the file object (userdata) is only collected at the end for small
programs ?

But, I think the best thing is to always close the file manually
because you neger know when the garbage collector runs.

Mildred
-- 
Mildred Ki'lya
E-Mail:	mildred593(at)online.fr

Site:	<http://mildred632.free.fr/>
XMPP:	<mildred@jabber.fr> (GoogleTalk, Jabber)

GPG:	197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]