[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: cleanup in a C module
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 23 Jun 2010 13:45:48 -0300
> Now, the module needs some cleanup at the end. It does work when I export
> a cleanup function, named "avt.quit()", and the script calls this function
> at its end. So far so good. That works.
> But it breaks, when the script doesn't call that function, for example
> when there is an error in the script, or someone forgets to call that function.
> So what I'd like to have is that a function is called automatically when
> the script ends - whether it ends with an error or at a normal end.
If you're embedding Lua then call the cleanup function manually from C
when the script ends. If you're using the standard Lua interpreter,
you can do the same if you run your script from a wrapper script.