lua-users home
lua-l archive

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


On Sat, May 23, 2020 at 7:59 PM Andrea <andrea.l.vitali@gmail.com> wrote:
> What happens in the following case:
> - I mark a local as to-be-closed,
> - then this is used as upvalue for an enclosed function,
> - then the function returns the enclosed function

Here the __close metamethod is called.

Please note that the <close> is an attribute of the variable, it is
NOT an attribute of the value. The value can "Escape" from the current
function in several ways (return, upvalue, global, etc), but the
variable still ends its scope when the function returns.