diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -678,22 +678,19 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, | |||
678 | L->nny = 0; /* allow yields */ | 678 | L->nny = 0; /* allow yields */ |
679 | api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); | 679 | api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); |
680 | status = luaD_rawrunprotected(L, resume, &nargs); | 680 | status = luaD_rawrunprotected(L, resume, &nargs); |
681 | if (unlikely(status == -1)) /* error calling 'lua_resume'? */ | 681 | /* continue running after recoverable errors */ |
682 | status = LUA_ERRRUN; | 682 | while (errorstatus(status) && recover(L, status)) { |
683 | else { /* continue running after recoverable errors */ | 683 | /* unroll continuation */ |
684 | while (errorstatus(status) && recover(L, status)) { | 684 | status = luaD_rawrunprotected(L, unroll, &status); |
685 | /* unroll continuation */ | 685 | } |
686 | status = luaD_rawrunprotected(L, unroll, &status); | 686 | if (likely(!errorstatus(status))) |
687 | } | 687 | lua_assert(status == L->status); /* normal end or yield */ |
688 | if (likely(!errorstatus(status))) | 688 | else { /* unrecoverable error */ |
689 | lua_assert(status == L->status); /* normal end or yield */ | 689 | status = luaF_close(L, L->stack, status); /* close all upvalues */ |
690 | else { /* unrecoverable error */ | 690 | L->status = cast_byte(status); /* mark thread as 'dead' */ |
691 | status = luaF_close(L, L->stack, status); /* close all upvalues */ | 691 | luaD_seterrorobj(L, status, L->stack + 1); /* push error message */ |
692 | L->status = cast_byte(status); /* mark thread as 'dead' */ | 692 | L->ci = &L->base_ci; /* back to the original C level */ |
693 | luaD_seterrorobj(L, status, L->stack + 1); /* push error message */ | 693 | L->ci->top = L->top; |
694 | L->ci = &L->base_ci; /* back to the original C level */ | ||
695 | L->ci->top = L->top; | ||
696 | } | ||
697 | } | 694 | } |
698 | *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield | 695 | *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield |
699 | : cast_int(L->top - (L->ci->func + 1)); | 696 | : cast_int(L->top - (L->ci->func + 1)); |