** Recovers from an error in a coroutine. Finds a recover point (if ** there is one) and completes the execution of the interrupted ** 'luaD_pcall'. If there is no recover point, returns zero. */
| 597 | ** 'luaD_pcall'. If there is no recover point, returns zero. |
| 598 | */ |
| 599 | static int recover (lua_State *L, int status) { |
| 600 | StkId oldtop; |
| 601 | CallInfo *ci = findpcall(L); |
| 602 | if (ci == NULL) return 0; /* no recovery point */ |
| 603 | /* "finish" luaD_pcall */ |
| 604 | oldtop = restorestack(L, ci->u2.funcidx); |
| 605 | luaF_close(L, oldtop, status); /* may change the stack */ |
| 606 | oldtop = restorestack(L, ci->u2.funcidx); |
| 607 | luaD_seterrorobj(L, status, oldtop); |
| 608 | L->ci = ci; |
| 609 | L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ |
| 610 | luaD_shrinkstack(L); |
| 611 | L->errfunc = ci->u.c.old_errfunc; |
| 612 | return 1; /* continue running the coroutine */ |
| 613 | } |
| 614 | |
| 615 | |
| 616 | /* |
no test coverage detected