MCPcopy Create free account
hub / github.com/Tencent/sluaunreal / modinit

Function modinit

Plugins/slua_unreal/External/lua/loadlib.cpp:656–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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