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

Function searcher_Croot

third-party/lua-5.3.5/src/loadlib.c:538–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536
537
538static int searcher_Croot (lua_State *L) {
539 const char *filename;
540 const char *name = luaL_checkstring(L, 1);
541 const char *p = strchr(name, '.');
542 int stat;
543 if (p == NULL) return 0; /* is root */
544 lua_pushlstring(L, name, p - name);
545 filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP);
546 if (filename == NULL) return 1; /* root not found */
547 if ((stat = loadfunc(L, filename, name)) != 0) {
548 if (stat != ERRFUNC)
549 return checkload(L, 0, filename); /* real error */
550 else { /* open function not found */
551 lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename);
552 return 1;
553 }
554 }
555 lua_pushstring(L, filename); /* will be 2nd argument to module */
556 return 2;
557}
558
559
560static 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