lua-users home
lua-l archive

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

This is the case: my lightuserdata/heavyurserdata pairs are kept in a table,
itself stored in the registry.

> -----Original Message-----
> From: Roberto Ierusalimschy []
> Sent: vendredi 6 septembre 2002 21:16
> To: Multiple recipients of list
> Subject: Re: Light User Data 
> > If you want to allow the heavy userdatas to be garbage
> > collected, you could just give your registry a metatable
> > with weakmode="v".
> Please notice that we changed (back) the way you make a table 
> weak: you
> should use «setmode(t, "v")» (or lua_setmode, in C), instead of using
> the metatable.
> Also notice that it is not "polite" to change the weak mode of the
> registry, as that table is shared by several libraries. Instead, you
> should create a separate table (which can be stored in a 
> registry field)
> and set its mode to weak.
> -- Roberto