lua-users home
lua-l archive

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


Well, sounds like the right thing... (actually it's more meaningful for the
init func to do that, kind-of 'atexit()' in ANSI C) but
_all_too_complicated_ unless there is a nice 'lauxlib' wrapping for all
this.

For example:

	void luaL_atexit( lua_CFunction my_cleanup_func );

I didn't find anything such in a quick glance at 5.0w0 lauxlib.

- asko

--
Asko Kauppi
Flextronics Design Finland
Box 23, 39201 Kyröskoski, Finland
www.flextronics.com

> -----Original Message-----
> From:	Luiz Henrique de Figueiredo [SMTP:lhf@tecgraf.puc-rio.br]
> Sent:	Monday, June 10, 2002 4:59 PM
> To:	Asko.Kauppi@fi.flextronics.com
> Cc:	lua-l@tecgraf.puc-rio.br
> Subject:	Re: Loadlib's callfromlib() - anybody using it?!?
> 
> >The only major need I found with 5.0 'lua.c' concerning this was the
> >capability to have library cleanups
> 
> There a trick for this that could/should be implemented in lauxlib:
> Each time you open a library that needs to clean itselt up, create a
> userdata,
> store it in the registry (using itself as both key and value), and set up
> a GC
> method for this userdata that does the cleanup. When lua_close is called,
> your
> GC method will be called automatically.
> --lhf
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.