lua-users home
lua-l archive

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


> > I think it is best to just keep track of the state of your userdata  
> > and any associated resources. For example: if your userdata is a  
> > struct, add a field to mark when it is finalized. If your userdata  
> > is a boxed pointer, make sure you nullify the pointer when you are  
> > done with it.
	We do exactly this in the implementation of LuaSQL.

> Yes, I've done this now... but still I think __gc should be private  
> by default.
	In LuaSQL, the `close' method and the `__gc' metamethod are
the same C function.  Do you have a better idea?

	Tomás