lua-users home
lua-l archive

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

Am 23.02.2016 um 23:00 schröbte Sean Conner:

   It's not documented (at least, I didn't see it mentioned in the
description for for Lua 5.1, 5.2 or 5.3), but Lua does return a
third parameter for

For Lua 5.1:
For Lua 5.2:
For Lua 5.3:

Unless otherwise stated, all I/O functions return nil on failure
(plus an error message as a second result and a system-dependent
error code as a third result) and some value different from nil on
success. On non-POSIX systems, the computation of the error message
and error code in case of errors may be not thread safe, because
they rely on the global C variable errno.

The weird thing is that the entry for `` *does* state otherwise:

This function opens a file, in the mode specified in the string mode.
It returns a new file handle, or, in case of errors, nil plus an
error message.