lua-users home
lua-l archive

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


On Tue, Jan 20, 2009 at 12:00:50AM -0500, David Manura wrote:
> The Lua reference manual doesn't describe the error handling behavior
> of file:write and some related functions.  In practice, file:write
> returns a true on success and (nil, errorstring, errornumber) on error
> given the return status of the underlying fwrite[1].  file:read
> behaves similarly.  The iterator function returned by file:lines()
> raises on error.  The reference manual does, however, say that
> file:seek returns nil plus a string on error.
>
> [1] http://www.opengroup.org/onlinepubs/007908775/xsh/fwrite.html

Aren't these functions covered by "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." from the top of the section?

Though that doesn't cover file:lines throwing an error, and I'd argue that
the file:seek specific text is unnecessary (given the above).

    -Etan