lua-users home
lua-l archive

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


> I'm trying (unsuccessfully) to see in the docs if a function argument
> can be collected during a pcall. What I mean is:
> 
> 0.- I push a function.
> 1.- I push a userdata object as argument.
> 2.- I do lua_pcall(L,1,1,0) ( Or lua_call or other similar stuff ).
> 
> Can my object be garbage collected before returning from pcall (i.e.,
> if the function sets its argument to nil and then calls collectgarbage
> ).?

I am not sure what you are trying to find in the docs. If an object is
garbage (it cannot be accessed from Lua), it can be collected. 'pcall'
has nothing to do with that.


> I need to know this because the object I push has a __gc method which
> destroys it, and I need to access some data inside it just after
> return.

How are going to access that data inside the object without a reference
to it?

-- Roberto