MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / modinit

Function modinit

ThirdParty/lua/lua/loadlib.c:618–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616
617
618static void modinit (lua_State *L, const char *modname) {
619 const char *dot;
620 lua_pushvalue(L, -1);
621 lua_setfield(L, -2, "_M"); /* module._M = module */
622 lua_pushstring(L, modname);
623 lua_setfield(L, -2, "_NAME");
624 dot = strrchr(modname, '.'); /* look for last dot in module name */
625 if (dot == NULL) dot = modname;
626 else dot++;
627 /* set _PACKAGE as package name (full module name minus last part) */
628 lua_pushlstring(L, modname, dot - modname);
629 lua_setfield(L, -2, "_PACKAGE");
630}
631
632
633static int ll_module (lua_State *L) {

Callers 1

ll_moduleFunction · 0.85

Calls 5

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

Tested by

no test coverage detected