[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (rc4) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 1 Dec 2011 19:11:03 -0200
> So if we have two new userdata in global variables u1 and u2:
>
> setmetatable(u1, {__gc = function() end)
> -- u2 does not have a __gc metamethod
> uservalue = {link = u2}
> debug.setuservalue(u1, uservalue)
> u1, u2, uservalue = nil, nil, nil
> collectgarbage "collect"
>
> My question is: can we expect uservalue (the table) and u2 to be
> "resurrected" temporarily?
Sure. They are resurrected as much as u1 is, because the __gc in u1
might access any of these values.
Note that this already was true in 5.1, but the documentation was
not very clear about that.
-- Roberto