lua-users home
lua-l archive

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


Am 24.06.2015 um 01:51 schröbte Soni L.:



and

TValue l_registry;

out of the global_State and into the lua_State.

And then `io.open` wouldn't find its metatable when called from within
a coroutine, C libraries would be loaded and gc'd multiple times, etc.
...

How's that any different from creating multiple global states?


With multiple global Lua states

*   If you have `io.open`, you also have the FILE* metatable.
* When the registry is collected and C libraries are unloaded, no function can run and call unloaded C functions (this is also a result of `dlopen`/`LoadLibrary` being reference counted).

Most of the current use of the registry (`_LOADED`, `CLIBS`, `luaL_checkudata`, `luaL_ref`) depends on the fact that there is only one registry in a global state.


Philipp