[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Setting metatable to nil?
- From: Mark Hamburg <mhamburg@...>
- Date: Mon, 27 Mar 2006 08:58:57 -0800
I haven't checked 5.1 final, but earlier versions of 5.1 would crash if you
did this because components such as the GC assumed it wouldn't be nil.
I would expect that there would actually be a performance win to supporting
nil since the GC could avoid repeatedly tracing the superfluous link.
Mark
on 3/20/06 10:37 AM, King, Mike at MKing@klmicrowave.com wrote:
> Is it okay to set the metatable of a userdata to nil? In my C++
> program, a Lua function handles a C++ event. I'm pasting to it a
> userdata that has a metatable associated with it. I want to prevent the
> functions of the userdata's metatable from being called after the event
> has occurred. I'm thinking I can do this by setting the userdata's
> metatable to nil after the event has been invoked.