MCPcopy Create free account
hub / github.com/DFHack/dfhack / createclibstable

Function createclibstable

depends/lua/src/loadlib.c:757–764  ·  view source on GitHub ↗

** create table CLIBS to keep track of loaded C libraries, ** setting a finalizer to close all libraries when closing state. */

Source from the content-addressed store, hash-verified

755** setting a finalizer to close all libraries when closing state.
756*/
757static void createclibstable (lua_State *L) {
758 lua_newtable(L); /* create CLIBS table */
759 lua_createtable(L, 0, 1); /* create metatable for CLIBS */
760 lua_pushcfunction(L, gctm);
761 lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */
762 lua_setmetatable(L, -2);
763 lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */
764}
765
766
767LUAMOD_API int luaopen_package (lua_State *L) {

Callers 1

luaopen_packageFunction · 0.85

Calls 4

lua_createtableFunction · 0.85
lua_setfieldFunction · 0.85
lua_setmetatableFunction · 0.85
lua_rawsetpFunction · 0.85

Tested by

no test coverage detected