lua-users home
lua-l archive

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


> > And then it really would be much better, if the __close metafunction
> > is used automatically (if it exists).
>
> You have one of these, it is called __gc.

Thank you, this is interesting remark, also this sort of "competition"
between __close and __gc.

Would __gc be invoked for local variables or not?

In the Reference Manual the local variables are described in §3.2, but
their closing behaviour is a bit unclear I think. I cannot really
recognize, whether local variables are destroyed by gc, or whether
they exist on stack and are destroyed "automatically" and end of their
scope?