> I would say that it’s necessary for serious code to check the return value of *both* open and close.
Sigh. I could not agree more.
But, again, I find this behaviour inconsistent (with read and write) and very error prone. Not only is this inconsistent, the equivalence of file:close() with io.close() is questionable. There is no good reason while f.close() (with no arguments) should try to close something that has nothing to do with f. io.close() might have a good reason for that, but there is no intrinsic reason why f.close() should just do the same thing.