** create table CLIBS to keep track of loaded C libraries, ** setting a finalizer to close all libraries when closing state. */
| 783 | ** setting a finalizer to close all libraries when closing state. |
| 784 | */ |
| 785 | static void createclibstable (lua_State *L) { |
| 786 | lua_newtable(L); /* create CLIBS table */ |
| 787 | lua_createtable(L, 0, 1); /* create metatable for CLIBS */ |
| 788 | lua_pushcfunction(L, gctm); |
| 789 | lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ |
| 790 | lua_setmetatable(L, -2); |
| 791 | lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */ |
| 792 | } |
| 793 | #endif |
| 794 | |
| 795 | LUAMOD_API int luaopen_package (lua_State *L) { |
nothing calls this directly
no test coverage detected