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

Function luaD_poscall

depends/lua/src/ldo.c:376–391  ·  view source on GitHub ↗

** Finishes a function call: calls hook if necessary, removes CallInfo, ** moves current number of results to proper place; returns 0 iff call ** wanted multiple (variable number of) results. */

Source from the content-addressed store, hash-verified

374** wanted multiple (variable number of) results.
375*/
376int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) {
377 StkId res;
378 int wanted = ci->nresults;
379 if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {
380 if (L->hookmask & LUA_MASKRET) {
381 ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */
382 luaD_hook(L, LUA_HOOKRET, -1);
383 firstResult = restorestack(L, fr);
384 }
385 L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */
386 }
387 res = ci->func; /* res == final position of 1st result */
388 L->ci = ci->previous; /* back to caller */
389 /* move results to proper place */
390 return moveresults(L, firstResult, res, nres, wanted);
391}
392
393
394

Callers 4

luaV_executeFunction · 0.85
luaD_precallFunction · 0.85
finishCcallFunction · 0.85
resumeFunction · 0.85

Calls 2

luaD_hookFunction · 0.85
moveresultsFunction · 0.85

Tested by

no test coverage detected