lua-users home
lua-l archive

Re: errno handling on sys.() and io.() functions

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


> Today I noticed that these functions also return errno as third return value.
> This seems to be mentioned in PIL, but is omitted in the reference manual. Is
> this officialy part of the Lua API, and is it safe to depend on this behaviour?
* http://www.lua.org/manual/5.2/manual.html#6.8
 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) [...]
* http://www.lua.org/manual/5.2/manual.html#pdf-os.remove
 os.remove (filename)
 [...] If this function fails, it returns nil, plus a string describing
 the error and the error code.
 ...
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /