MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / searcher_Croot

Function searcher_Croot

extlibs/lua/src/loadlib.c:581–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579
580
581static int searcher_Croot (lua_State *L) {
582 const char *filename;
583 const char *name = luaL_checkstring(L, 1);
584 const char *p = strchr(name, '.');
585 int stat;
586 if (p == NULL) return 0; /* is root */
587 lua_pushlstring(L, name, p - name);
588 filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP);
589 if (filename == NULL) return 1; /* root not found */
590 if ((stat = loadfunc(L, filename, name)) != 0) {
591 if (stat != ERRFUNC)
592 return checkload(L, 0, filename); /* real error */
593 else { /* open function not found */
594 lua_pushfstring(L, "no module '%s' in file '%s'", name, filename);
595 return 1;
596 }
597 }
598 lua_pushstring(L, filename); /* will be 2nd argument to module */
599 return 2;
600}
601
602
603static int searcher_preload (lua_State *L) {

Callers

nothing calls this directly

Calls 6

lua_pushlstringFunction · 0.85
findfileFunction · 0.85
loadfuncFunction · 0.85
checkloadFunction · 0.85
lua_pushfstringFunction · 0.85
lua_pushstringFunction · 0.85

Tested by

no test coverage detected