lua-users home
lua-l archive

Re: userdata access after __gc?

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


On Oct 16, 2012, at 9:43 AM, Josh Haberman wrote:
> I have discovered that I can access a userdata from Lua after its
> finalizer has run -- is this intended? A test program at the bottom
> of this email can demonstrate this on both Lua 5.2.1 and Lua 5.1.4.
> 
The reference manual actually does mention this in the description for
the __gc metamethod. It says that the handlers are run in reverse order
of creation and then:
"The userdata itself is freed only in the next garbage-collection cycle."
Cheers,
Richard

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