[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.4.0 (alpha) now available
- From: Sergey Kovalev <kovserg33@...>
- Date: Tue, 16 Jul 2019 00:31:30 +0300
вт, 16 июл. 2019 г. в 00:23, Gé Weijers <ge@weijers.org>:
>
>
> Something like his (untested):
>
> local function close_values(t)
> for _, val in pairs(t) do
> local <toclose> tmp = val
> end
> end
>
> local <toclose> array = setmetatable({}, {__close = close_values})
>
> When 'array' goes out of scope close_values will be called, which will call __close on all the values in the array.
>
1. I mean using syntax
if local f,err=io.open ...
and for f,err=io.open ...
2. Even this case.How you suggest to fill this array in case of possible errors?