lua-users home
lua-l archive

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


It was thus said that the Great Andrew Gierth once stated:
> >>>>> "Roberto" == Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
> 
>  >> An object reference may be abandoned as soon as the program gets to
>  >> the point where it will no longer need the object for its normal
>  >> execution (i.e. ignoring the effects of weak references and
>  >> finalizers). The finalizer can run any time after that (1ns or 1
>  >> year later).
> 
>  Roberto> +1.
> 
> So if one needs to prevent an object's removal from a weak table during
> the execution of a block of code, how should it be done, if simply
> assigning the value to a local isn't enough?

  Assigning it to a local is enough to keep it from being removed from a
weak table.

  -spc