lua-users home
lua-l archive

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

Viacheslav Usov <> wrote:
> The problem is that this does not raise a Lua error. It returns nil and
> the error message just like you say. That can just be ignored silently.
> I think it could also be said that checking f.close() for error returns
> would be unusual anyway.

Maybe this is the problem. I would say that it’s necessary for serious code
to check the return value of *both* open and close. (Both return nil and an
error message in Lua if they fail. Neither returns an error.)


PS See also here re “Dealing with error returns from close()”

We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
    Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System