[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: userdata access after __gc?
- From: Richard Hundt <richardhundt@...>
- Date: Tue, 16 Oct 2012 11:00:21 +0200
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."