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

Function modinit

third-party/lua-5.3.5/src/loadlib.c:658–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656
657
658static void modinit (lua_State *L, const char *modname) {
659 const char *dot;
660 lua_pushvalue(L, -1);
661 lua_setfield(L, -2, "_M"); /* module._M = module */
662 lua_pushstring(L, modname);
663 lua_setfield(L, -2, "_NAME");
664 dot = strrchr(modname, '.'); /* look for last dot in module name */
665 if (dot == NULL) dot = modname;
666 else dot++;
667 /* set _PACKAGE as package name (full module name minus last part) */
668 lua_pushlstring(L, modname, dot - modname);
669 lua_setfield(L, -2, "_PACKAGE");
670}
671
672
673static 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