On Sun, 2019-06-23 at 17:13 -0300, Soni "They/Them" L. wrote:
> I do wonder how <toclose> handles nil, and why it's a bug for
> <toclose>
> to close a non-closeable value.
>
> consider:
>
> local <toclose> f, err = io.open(foo)
> if not f then return nil, err end -- error: attempt to close
> non-closeable value
https://www.lua.org/work/doc/manual.html#3.3.8:
> If the value is nil, it is ignored; otherwise, if it does not have a
__close metamethod, an error is raised.
I think that in your case error is raised because `err` is marked at
toclose as well and it is a string (can't say for sure).
I have to admit that it's really inconvenient for this use case.