MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / searcher_Croot

Function searcher_Croot

libraries/AP_Scripting/lua/src/loadlib.c:544–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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