lua-users home
lua-l archive

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

On Mon, Oct 26, 1998 at 12:49:10PM -0200, Erik Hougaard wrote:
> To make Lua even more usable - I'm suggestion this addon to the GC
> system:
> When creating a user tag (lua_newtag) supply a function (or NULL) with
> the tag and then in luaS_free call the function with the pointer to the
> userdata. We can then program a C function that will free/close
> resources.
> In that way we can ensure that the garbage collection will/can clean
> whatever memory we have allocated, files we have opened (the iolib could
> also use this) resources allocated etc. without having to make sure that
> our users remember to call closefile/closedatabase/disconnectserver or
> whatever functions we might have in our system.

Uhm, you can already do that. Set a function for the "gc" tag method.

David Jeske (N9LCA) + +