lua-users home
lua-l archive

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

On Sun, 2023-08-27 at 19:09 +0200, bil til wrote:
> ... I hope this question is not too stupid, but where do you see a
> "to-be-closed" variable here? (as the keyword <close> is not used
> anywhere?)

Generic for loop implicitly introduces one in Lua 5.4. Quoting
reference manual:

> The loop starts by evaluating explist to produce four values: an
iterator function, a state, an initial value for the control variable,
and a closing value.


> The closing value behaves like a to-be-closed variable (see §3.3.8),
which can be used to release resources when the loop ends.

v <>