** create table CLIBS to keep track of loaded C libraries, ** setting a finalizer to close all libraries when closing state. */
| 728 | ** setting a finalizer to close all libraries when closing state. |
| 729 | */ |
| 730 | static void createclibstable (lua_State *L) { |
| 731 | luaL_getsubtable(L, LUA_REGISTRYINDEX, CLIBS); /* create CLIBS table */ |
| 732 | lua_createtable(L, 0, 1); /* create metatable for CLIBS */ |
| 733 | lua_pushcfunction(L, gctm); |
| 734 | lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ |
| 735 | lua_setmetatable(L, -2); |
| 736 | } |
| 737 | |
| 738 | |
| 739 | LUAMOD_API int luaopen_package (lua_State *L) { |
no test coverage detected