diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -676,12 +676,15 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, | |||
676 | /* unroll continuation */ | 676 | /* unroll continuation */ |
677 | status = luaD_rawrunprotected(L, unroll, &status); | 677 | status = luaD_rawrunprotected(L, unroll, &status); |
678 | } | 678 | } |
679 | if (unlikely(errorstatus(status))) { /* unrecoverable error? */ | 679 | if (likely(!errorstatus(status))) |
680 | lua_assert(status == L->status); /* normal end or yield */ | ||
681 | else { /* unrecoverable error */ | ||
682 | status = luaF_close(L, L->stack, status); /* close all upvalues */ | ||
680 | L->status = cast_byte(status); /* mark thread as 'dead' */ | 683 | L->status = cast_byte(status); /* mark thread as 'dead' */ |
681 | luaD_seterrorobj(L, status, L->top); /* push error message */ | 684 | luaD_seterrorobj(L, status, L->stack + 1); /* push error message */ |
685 | L->ci = &L->base_ci; /* back to the original C level */ | ||
682 | L->ci->top = L->top; | 686 | L->ci->top = L->top; |
683 | } | 687 | } |
684 | else lua_assert(status == L->status); /* normal end or yield */ | ||
685 | } | 688 | } |
686 | *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield | 689 | *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield |
687 | : cast_int(L->top - (L->ci->func + 1)); | 690 | : cast_int(L->top - (L->ci->func + 1)); |