MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / modinit

Function modinit

lua/loadlib.c:534–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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