lua-users home
lua-l archive

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


I did, 
lua_gc(lua_state_pointer, LUA_GCCOLLECT, 0)

Does the data argument mean anything for LUA_GCCOLLECT?

--Joe Gester

>  -------Original Message-------
>  From: Wesley Smith <wesley.hoke@gmail.com>
>  Subject: Re: __gc() isn't always called.
>  Sent: Sep 08 '08 22:59
>  
>  How are you calling lua_gc?
>  wes
>  
>  On Mon, Sep 8, 2008 at 1:16 PM, Joe Gester <joe@muzzylane.com> wrote:
>  > Hi,
>  >
>  > I have several full userdatas with metatables and a __gc metamethod
>  > implemented in C.  Storing the userdata in a global variable, I can access
>  > its members and call other metamethods like __index and __newindex as
>  > exoected.  If my script assigns nil to the global variable, the __gc method
>  > runs.  If I assign nil to the variable from C and use lua_gc to collect the
>  > garbage or call lua_close, the __gc method does not run.
>  >
>  > Should __gc called when the references are broken from outside the script
>  > and/or when lua_close is run?  Is there something in particular I ought to
>  > be doing to get __gc to run?  I would expect it to just work since garbage
>  > is properly collected when the references are broken from within the script.
>  >
>  > -- Joe Gester
>  >
>  >
>