lua-users home
lua-l archive

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


> > Nicolas Noble wrote:
> > >   I've been messing around with LUA since a few weeks now, and I'm
> > > wondering something. How exactly does the __gc metamethod works ? It just
> > > seems I'm not using it the right way. Look, if I use this piece of code:
> >
> > This one is thankfully easy to answer -- the __gc function has to
> > be a C function, not a lua function (though perversely, the
> > C function can then call a lua function if it likes).
>
> Ha, indeed, that's a damn good reason ;-)
>
> And when I read back the manual, yet it is unclear, but we might
> understand that it's right.
>
> But now, what dazzles me further is this new test, which _still_ doesn't
> work ^^; (no still __gc function called, basically same output than
> before)

Pah! Forget it. I read the manual a bit deeper, and I understood it works
_only_ for userdatas, not for tables. Really sorry for having wasted your
time ^^;