MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / searcher_Croot

Function searcher_Croot

third-party/lua-5.2.4/src/loadlib.c:445–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443
444
445static int searcher_Croot (lua_State *L) {
446 const char *filename;
447 const char *name = luaL_checkstring(L, 1);
448 const char *p = strchr(name, '.');
449 int stat;
450 if (p == NULL) return 0; /* is root */
451 lua_pushlstring(L, name, p - name);
452 filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP);
453 if (filename == NULL) return 1; /* root not found */
454 if ((stat = loadfunc(L, filename, name)) != 0) {
455 if (stat != ERRFUNC)
456 return checkload(L, 0, filename); /* real error */
457 else { /* open function not found */
458 lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
459 name, filename);
460 return 1;
461 }
462 }
463 lua_pushstring(L, filename); /* will be 2nd argument to module */
464 return 2;
465}
466
467
468static int searcher_preload (lua_State *L) {

Callers

nothing calls this directly

Calls 6

lua_pushlstringFunction · 0.70
findfileFunction · 0.70
loadfuncFunction · 0.70
checkloadFunction · 0.70
lua_pushfstringFunction · 0.70
lua_pushstringFunction · 0.70

Tested by

no test coverage detected