lua-users home
lua-l archive

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


At 08:38 5/18/99 -0300, you wrote:
>I think your plan will work.
>
>Don't forget to un-register your lua functions from your dll's clean-up
>code.  Otherwise Lua will end up with invalid function pointers.

well, I wasn't planning to unload the DLLs until the end of the application
(so no LUA script will be run anymore), but it'll be better to unregister
the functions if you provide runtime unloading as well. The reason I don't
want to unload DLLs during runtime is that you'll also want to check if
there aren't any variables present in the LUA environment that need the DLL
to be present. 

i.e.

if I have defined a new lua "class" type with an extension dll I don't want
the DLL to be unloaded until all variables of that specific class type get
destroyed... don't know what would happen if you did

anyone other ideas about loading/unloading LUA extension and making sure
code only gets unloaded when possible?

>There isn't a lua_unregister macro, but this should do the trick:
>
>#define lua_unregister(n)	(lua_pushnil(), lua_setglobal(n))

ok, thanks

Jeroen