[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Reference doubts (2)
- From: Enrico Colombini <erix@...>
- Date: Tue, 2 Mar 2004 12:52:50 +0100
1) Does io.output() close the previously default output file (if any) or
should the latter be closed with io.close() before calling io.output() to
select another output file?
2) The reference manual says (5.4): "Unless otherwise stated, all I/O
functions return nil on failure (plus an error message as a second result)
and some value different from nil on success".
However, file.close() seems to return true on success, but calls an error on
failure.
3) In which mode does io.input(filename) open the file? "r" or "w"? (is "in
text mode" in the reference manual a typo? My 5-2003 version could not be the
latest).
4) Does io.input() return a file object (handle) even when an argument is
given? It seems so.
5) same as 4) for io.output.
Enrico
P.S. I thought that a Lua programmer is not necessarily a C programmer, so in
the reference card (well, "large card") I am detailing also the math library
and the format() directives.