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

Function finishCcall

depends/lua/src/ldo.c:518–537  ·  view source on GitHub ↗

** Completes the execution of an interrupted C function, calling its ** continuation function. */

Source from the content-addressed store, hash-verified

516** continuation function.
517*/
518static void finishCcall (lua_State *L, int status) {
519 CallInfo *ci = L->ci;
520 int n;
521 /* must have a continuation and must be able to call it */
522 lua_assert(ci->u.c.k != NULL && L->nny == 0);
523 /* error status can only happen in a protected call */
524 lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD);
525 if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */
526 ci->callstatus &= ~CIST_YPCALL; /* continuation is also inside it */
527 L->errfunc = ci->u.c.old_errfunc; /* with the same error function */
528 }
529 /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already
530 handled */
531 adjustresults(L, ci->nresults);
532 lua_unlock(L);
533 n = (*ci->u.c.k)(L, status, ci->u.c.ctx); /* call continuation function */
534 lua_lock(L);
535 api_checknelems(L, n);
536 luaD_poscall(L, ci, L->top - n, n); /* finish 'luaD_precall' */
537}
538
539
540/*

Callers 1

unrollFunction · 0.85

Calls 1

luaD_poscallFunction · 0.85

Tested by

no test coverage detected