lua-users home
lua-l archive

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



On 5-Oct-06, at 6:23 PM, Glenn Maynard wrote:

(But libraries aren't necessarily doing the same thing, so if I just
remove that "self" trick from luaL_argerror, then everything else will
be wrong, in the opposite direction.)

And for a good reason. If you remove the 'self' argument from the stack, and there is no other reference to it, then it could get garbage collected while your method is running, with possibly disastrous consequences.

I suppose that you are either forcing the object to stay in existence by keeping a luaL_ref to it, or being very careful to never do anything which might trigger a garbage collection. On the whole, it doesn't strike me as a good idea, but tastes (and problem domains) vary.