lua-users home
lua-l archive

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


On Wed, Jun 23, 2010 at 09:31:21PM +0200, Mailing-Listen wrote:
> On Wed, Jun 23, 2010 at 10:17:16PM +0300, M Joonas Pihlaja wrote:
> > 
> > > 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.
> 
> That sounds like it is what I was looking for. I admit that I am not
> that deep into lua, yet. But I'm definitely going to have a look at it.

Well, it's harder than I thought.
But I keep it on my TODO list... :-\

-- 
AKFoerster