MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / modinit

Function modinit

third-party/lua-5.2.4/src/loadlib.c:570–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568
569
570static void modinit (lua_State *L, const char *modname) {
571 const char *dot;
572 lua_pushvalue(L, -1);
573 lua_setfield(L, -2, "_M"); /* module._M = module */
574 lua_pushstring(L, modname);
575 lua_setfield(L, -2, "_NAME");
576 dot = strrchr(modname, '.'); /* look for last dot in module name */
577 if (dot == NULL) dot = modname;
578 else dot++;
579 /* set _PACKAGE as package name (full module name minus last part) */
580 lua_pushlstring(L, modname, dot - modname);
581 lua_setfield(L, -2, "_PACKAGE");
582}
583
584
585static int ll_module (lua_State *L) {

Callers 1

ll_moduleFunction · 0.70

Calls 4

lua_pushvalueFunction · 0.70
lua_setfieldFunction · 0.70
lua_pushstringFunction · 0.70
lua_pushlstringFunction · 0.70

Tested by

no test coverage detected