lua-users home
lua-l archive

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


Is there any way to unload a shared library after is has been loaded by require()? After a bit of poking around in the Lua sources and some testing, it seems like shared libraries only get unloaded when the corresponding userdata object containing the library handle ( stored in LUA_REGISTRYINDEX ) gets collected when the the Lua state is closed. 

Is there any way to unload the shared libraries any sooner? What if your script was to load a bunch of large shared libraries for initialization, but then didn't need them for the rest time it was running. Right now, it seems like they would all remain loaded even though they weren't needed.

Peter