MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / finishpcallk

Function finishpcallk

lib/lua/src/ldo.c:675–692  ·  view source on GitHub ↗

** Finish the job of 'lua_pcallk' after it was interrupted by an yield. ** (The caller, 'finishCcall', does the final call to 'adjustresults'.) ** The main job is to complete the 'luaD_pcall' called by 'lua_pcallk'. ** If a '__close' method yields here, eventually control will be back ** to 'finishCcall' (when that '__close' method finally returns) and ** 'finishpcallk' will run again and close an

Source from the content-addressed store, hash-verified

673** multiple runs, changing only if there is a new error.
674*/
675static int finishpcallk (lua_State *L, CallInfo *ci) {
676 int status = getcistrecst(ci); /* get original status */
677 if (l_likely(status == LUA_OK)) /* no error? */
678 status = LUA_YIELD; /* was interrupted by an yield */
679 else { /* error */
680 StkId func = restorestack(L, ci->u2.funcidx);
681 L->allowhook = getoah(ci->callstatus); /* restore 'allowhook' */
682 func = luaF_close(L, func, status, 1); /* can yield or raise an error */
683 luaD_seterrorobj(L, status, func);
684 luaD_shrinkstack(L); /* restore stack size in case of overflow */
685 setcistrecst(ci, LUA_OK); /* clear original status */
686 }
687 ci->callstatus &= ~CIST_YPCALL;
688 L->errfunc = ci->u.c.old_errfunc;
689 /* if it is here, there were errors or yields; unlike 'lua_pcallk',
690 do not change status */
691 return status;
692}
693
694
695/*

Callers 1

finishCcallFunction · 0.85

Calls 3

luaF_closeFunction · 0.85
luaD_seterrorobjFunction · 0.85
luaD_shrinkstackFunction · 0.85

Tested by

no test coverage detected