MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / modinit

Function modinit

src/Chain/libraries/glua/loadlib.cpp:700–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698
699
700static void modinit(lua_State *L, const char *modname) {
701 const char *dot;
702 lua_pushvalue(L, -1);
703 lua_setfield(L, -2, "_M"); /* module._M = module */
704 lua_pushstring(L, modname);
705 lua_setfield(L, -2, "_NAME");
706 dot = strrchr(modname, '.'); /* look for last dot in module name */
707 if (dot == nullptr) dot = modname;
708 else dot++;
709 /* set _PACKAGE as package name (full module name minus last part) */
710 lua_pushlstring(L, modname, dot - modname);
711 lua_setfield(L, -2, "_PACKAGE");
712}
713
714
715static int ll_module(lua_State *L) {

Callers 1

ll_moduleFunction · 0.85

Calls 4

lua_pushvalueFunction · 0.85
lua_setfieldFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushlstringFunction · 0.85

Tested by

no test coverage detected