** 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. */
| 374 | ** wanted multiple (variable number of) results. |
| 375 | */ |
| 376 | int 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 |
no test coverage detected