lua-users home
lua-l archive

Re: A stupid question

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


On 2008年3月31日 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.

AltStyle によって変換されたページ (->オリジナル) /