** 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. */
| 482 | ** wanted multiple (variable number of) results. |
| 483 | */ |
| 484 | int luaD_poscall(lua_State *L, CallInfo *ci, StkId firstResult, int nres) { |
| 485 | StkId res; |
| 486 | int wanted = ci->nresults; |
| 487 | if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { |
| 488 | if (L->hookmask & LUA_MASKRET) { |
| 489 | ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ |
| 490 | luaD_hook(L, LUA_HOOKRET, -1); |
| 491 | firstResult = restorestack(L, fr); |
| 492 | } |
| 493 | L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ |
| 494 | } |
| 495 | res = ci->func; /* res == final position of 1st result */ |
| 496 | L->ci = ci->previous; /* back to caller */ |
| 497 | /* move results to proper place */ |
| 498 | return moveresults(L, firstResult, res, nres, wanted); |
| 499 | } |
| 500 | |
| 501 | |
| 502 | /* |
no test coverage detected