[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: metatable for the registry?
- From: Josh Haberman <jhaberman@...>
- Date: Mon, 19 Jul 2010 02:37:30 +0000 (UTC)
Josh Haberman <jhaberman <at> gmail.com> writes:
> Roberto Ierusalimschy <roberto <at> inf.puc-rio.br> writes:
> > > Is setting a metatable on the registry supported? Should it be?
> >
> > The registry is a regular table, so you can set a metatable for it.
>
> Interestingly enough, I just ran into the opposite problem. It appears
> that my __gc method isn't respected when I do the C equivalent of:
>
> setmetatable({}, {__index = {__gc = foo}})
>
> Lua only seems to find __gc when it is set directly on the metatable.
> It doesn't find it via __index.
To clarify, in C it is indeed a userdata I am setting the metatable on,
not a table as in the faux Lua example above.
Josh