MCPcopy Create free account
hub / github.com/DFHack/dfhack / recover

Function recover

depends/lua/src/ldo.c:581–595  ·  view source on GitHub ↗

** 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. */

Source from the content-addressed store, hash-verified

579** 'luaD_pcall'. If there is no recover point, returns zero.
580*/
581static int recover (lua_State *L, int status) {
582 StkId oldtop;
583 CallInfo *ci = findpcall(L);
584 if (ci == NULL) return 0; /* no recovery point */
585 /* "finish" luaD_pcall */
586 oldtop = restorestack(L, ci->extra);
587 luaF_close(L, oldtop);
588 seterrorobj(L, status, oldtop);
589 L->ci = ci;
590 L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */
591 L->nny = 0; /* should be zero to be yieldable */
592 luaD_shrinkstack(L);
593 L->errfunc = ci->u.c.old_errfunc;
594 return 1; /* continue running the coroutine */
595}
596
597
598/*

Callers 1

lua_resumeFunction · 0.85

Calls 4

findpcallFunction · 0.85
luaF_closeFunction · 0.85
seterrorobjFunction · 0.85
luaD_shrinkstackFunction · 0.85

Tested by

no test coverage detected