| 427 | |
| 428 | |
| 429 | static int loader_Croot (lua_State *L) { |
| 430 | const char *funcname; |
| 431 | const char *filename; |
| 432 | const char *name = luaL_checkstring(L, 1); |
| 433 | const char *p = strchr(name, '.'); |
| 434 | int stat; |
| 435 | if (p == NULL) return 0; /* is root */ |
| 436 | lua_pushlstring(L, name, p - name); |
| 437 | filename = findfile(L, lua_tostring(L, -1), "cpath"); |
| 438 | if (filename == NULL) return 1; /* root not found */ |
| 439 | funcname = mkfuncname(L, name); |
| 440 | if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { |
| 441 | if (stat != ERRFUNC) loaderror(L, filename); /* real error */ |
| 442 | lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, |
| 443 | name, filename); |
| 444 | return 1; /* function not found */ |
| 445 | } |
| 446 | return 1; |
| 447 | } |
| 448 | |
| 449 | |
| 450 | static int loader_preload (lua_State *L) { |
nothing calls this directly
no test coverage detected