MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / modinit

Function modinit

deps/lua/src/loadlib.c:529–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527
528
529static void modinit (lua_State *L, const char *modname) {
530 const char *dot;
531 lua_pushvalue(L, -1);
532 lua_setfield(L, -2, "_M"); /* module._M = module */
533 lua_pushstring(L, modname);
534 lua_setfield(L, -2, "_NAME");
535 dot = strrchr(modname, '.'); /* look for last dot in module name */
536 if (dot == NULL) dot = modname;
537 else dot++;
538 /* set _PACKAGE as package name (full module name minus last part) */
539 lua_pushlstring(L, modname, dot - modname);
540 lua_setfield(L, -2, "_PACKAGE");
541}
542
543
544static 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