[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Reference doubts (2)
- From: Enrico Colombini <erix@...>
- Date: Wed, 3 Mar 2004 17:23:57 +0100
On Wednesday 03 March 2004 13:46, Roberto Ierusalimschy wrote:
[regarding file.close() calling an error on failure]
> Are you sure?
Here is what I mean:
Lua 5.0 Copyright (C) 1994-2003 Tecgraf, PUC-Rio
> f = io.open("test.test", "w")
> r = io.close(f) -- or: r = f:close()
> r = io.close(f)
stdin:1: attempt to use a closed file
[C]: in function `close'
stdin:1: in main chunk
Perhaps "on failure" refers only to the underlying fclose() failing,
not to the case of calling io.close() with an already closed file?
(I didn't try other file functions in the same situation)