lua-users home
lua-l archive

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


> Then I wanted to compile the language binding as a module. That works fine as 
> long as it runs. But I have the problem, that I don't know how to do the 
> cleanup afterwards.

When your module is opened for the first time you can store a userdata 
in the registry and set the userdata's __gc metamethod to do whatever 
cleanup you need.  When the lua_State is being destroyed your cleanup 
function will be executed before your module is unloaded by Lua.

Joonas