lua-users home
lua-l archive

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

I noticed a possible issue of the __close metamethod:  nil is a valid value for raising errors, but __close cannot distinguish between nil error and no error.

Other functions passing errors (pcall, etc.) seem to use a status + err tuple, so the cases can be distinguished.

Since the manual says "nil and false are ignored as to-be-closed values", I wonder if the first arg of __close can be overloaded to convey the error case, by the value false, which otherwise can't happen.