lua-users home
lua-l archive

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


On Saturday 15 October 2005 06:46, Ariel Manzur wrote:
> On Tue, Oct 11, 2005 at 03:29:11PM -0400, Doug Rogers wrote:
> > Henderson, Michael D wrote:
> >
> > I provide a 'new()' function that creates an object, sticks it in a
> > newly created table as a lightuserdata with key "__self", and attaches
> > the metatable to it. The "__gc" key in the metatable is attached to a
> > function that calls the destructor. This is SHWEET! The metatable's
>
> You have a table with a __gc metamethod and that works? is that a new 5.1
> thing?

I think he means that the metatable is attached to the *lightuserdata* --- 
which, IIRC, is the only situation where the __gc key is honoured. (Because 
finalisers are a horrible nightmare, and the only sane way to deal with them 
is to only allow them when you absolutely have to --- see earlier mailing 
list discussions on this topic.)

-- 
+- David Given --McQ-+ "Every planet is weird. I spent six weeks on a
|  dg@cowlark.com    | moon where the principal form of recreation was
| (dg@tao-group.com) | juggling geese. Baby geese. Goslings. They were
+- www.cowlark.com --+ juggled." --- Firefly, _Our Mrs. Reynolds_

Attachment: pgpjCu7IOoxx1.pgp
Description: PGP signature