lua-users home
lua-l archive

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


On Mon, 31 Mar 2008 18:47:02 +0200
Enrico Colombini <erix@erix.it> wrote:

> Do both functions share 'a' as an upvalue?
yes.

> If so, how can they hold a reference to a simple
> value (as opposed, for example, as to a table)?
compiler magic, upvalue is a special reference that is invisible to
user (but you can examine it with debug library).

> The second question, which prompted me to ask, is: if I remove both 
> functions:
>    t = {}
> does 'a' get collected at gc? (assuming there are no other reference
> to it)
yes.