diff options
Diffstat (limited to 'loadlib.c')
-rw-r--r-- | loadlib.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -621,12 +621,12 @@ static void findloader (lua_State *L, const char *name) { | |||
621 | != LUA_TTABLE)) | 621 | != LUA_TTABLE)) |
622 | luaL_error(L, "'package.searchers' must be a table"); | 622 | luaL_error(L, "'package.searchers' must be a table"); |
623 | luaL_buffinit(L, &msg); | 623 | luaL_buffinit(L, &msg); |
624 | luaL_addstring(&msg, "\n\t"); /* error-message prefix for first message */ | ||
624 | /* iterate over available searchers to find a loader */ | 625 | /* iterate over available searchers to find a loader */ |
625 | for (i = 1; ; i++) { | 626 | for (i = 1; ; i++) { |
626 | luaL_addstring(&msg, "\n\t"); /* error-message prefix */ | ||
627 | if (l_unlikely(lua_rawgeti(L, 3, i) == LUA_TNIL)) { /* no more searchers? */ | 627 | if (l_unlikely(lua_rawgeti(L, 3, i) == LUA_TNIL)) { /* no more searchers? */ |
628 | lua_pop(L, 1); /* remove nil */ | 628 | lua_pop(L, 1); /* remove nil */ |
629 | luaL_buffsub(&msg, 2); /* remove prefix */ | 629 | luaL_buffsub(&msg, 2); /* remove last prefix */ |
630 | luaL_pushresult(&msg); /* create error message */ | 630 | luaL_pushresult(&msg); /* create error message */ |
631 | luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); | 631 | luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); |
632 | } | 632 | } |
@@ -637,11 +637,10 @@ static void findloader (lua_State *L, const char *name) { | |||
637 | else if (lua_isstring(L, -2)) { /* searcher returned error message? */ | 637 | else if (lua_isstring(L, -2)) { /* searcher returned error message? */ |
638 | lua_pop(L, 1); /* remove extra return */ | 638 | lua_pop(L, 1); /* remove extra return */ |
639 | luaL_addvalue(&msg); /* concatenate error message */ | 639 | luaL_addvalue(&msg); /* concatenate error message */ |
640 | luaL_addstring(&msg, "\n\t"); /* prefix for next message */ | ||
640 | } | 641 | } |
641 | else { /* no error message */ | 642 | else /* no error message */ |
642 | lua_pop(L, 2); /* remove both returns */ | 643 | lua_pop(L, 2); /* remove both returns */ |
643 | luaL_buffsub(&msg, 2); /* remove prefix */ | ||
644 | } | ||
645 | } | 644 | } |
646 | } | 645 | } |
647 | 646 | ||