MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / loader_Croot

Function loader_Croot

Source/Misc/lua/src/lua.c:13182–13200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13180
13181
13182static int loader_Croot (lua_State *L) {
13183const char *funcname;
13184const char *filename;
13185const char *name = luaL_checkstring(L, 1);
13186const char *p = strchr(name, '.');
13187int stat;
13188if (p == NULL) return 0; /* is root */
13189lua_pushlstring(L, name, p - name);
13190filename = findfile(L, lua_tostring(L, -1), "cpath");
13191if (filename == NULL) return 1; /* root not found */
13192funcname = mkfuncname(L, name);
13193if ((stat = ll_loadfunc(L, filename, funcname)) != 0) {
13194if (stat != ERRFUNC) loaderror(L, filename); /* real error */
13195lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
13196name, filename);
13197return 1; /* function not found */
13198}
13199return 1;
13200}
13201
13202
13203static int loader_preload (lua_State *L) {

Callers

nothing calls this directly

Calls 6

lua_pushlstringFunction · 0.85
findfileFunction · 0.85
mkfuncnameFunction · 0.85
ll_loadfuncFunction · 0.85
loaderrorFunction · 0.85
lua_pushfstringFunction · 0.85

Tested by

no test coverage detected