MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / modinit

Function modinit

other_src/lua/src/loadlib.cpp:544–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542
543
544static void modinit (lua_State *L, const char *modname) {
545 const char *dot;
546 lua_pushvalue(L, -1);
547 lua_setfield(L, -2, "_M"); /* module._M = module */
548 lua_pushstring(L, modname);
549 lua_setfield(L, -2, "_NAME");
550 dot = strrchr(modname, '.'); /* look for last dot in module name */
551 if (dot == NULL) dot = modname;
552 else dot++;
553 /* set _PACKAGE as package name (full module name minus last part) */
554 lua_pushlstring(L, modname, dot - modname);
555 lua_setfield(L, -2, "_PACKAGE");
556}
557
558
559static 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