| 412 | |
| 413 | |
| 414 | static int loader_Croot (lua_State *L) { |
| 415 | const char *funcname; |
| 416 | const char *filename; |
| 417 | const char *name = luaL_checkstring(L, 1); |
| 418 | const char *p = strchr(name, '.'); |
| 419 | int stat; |
| 420 | if (p == NULL) return 0; /* is root */ |
| 421 | lua_pushlstring(L, name, p - name); |
| 422 | filename = findfile(L, lua_tostring(L, -1), "cpath"); |
| 423 | if (filename == NULL) return 1; /* root not found */ |
| 424 | funcname = mkfuncname(L, name); |
| 425 | if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { |
| 426 | if (stat != ERRFUNC) loaderror(L, filename); /* real error */ |
| 427 | lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, |
| 428 | name, filename); |
| 429 | return 1; /* function not found */ |
| 430 | } |
| 431 | return 1; |
| 432 | } |
| 433 | |
| 434 | |
| 435 | static int loader_preload (lua_State *L) { |
nothing calls this directly
no test coverage detected