lua-users home
lua-l archive

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

The way I've always handled this is to create a tag number just for
"dead" variables, and change the lua Object to the dead tag number
using lua_settag().  That way, you can know its not valid anymore
and not use it, even if it is still in scope under Lua.


Dan Marks

On Thu, Aug 27, 1998 at 12:18:44PM -0300, Erik Hougaard wrote:
> Quick question:
> I have a piece of code that receive a userdata with a C pointer in it!.
> My C function frees the pointer and I want to "delete" the variable that
> was passed to my function -  What to do?
> Erik Hougaard
> p.s.
> Example:
> s = createsession("modem") <- 's' now has a pointer to a allocated
> struct...
> ...
> ...
> killsession(s)             <- I'm freeing the memory - How do I get rid
> of s ?