** 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. */
| 383 | ** wanted multiple (variable number of) results. |
| 384 | */ |
| 385 | int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres) { |
| 386 | StkId res; |
| 387 | int wanted = ci->nresults; |
| 388 | if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { |
| 389 | if (L->hookmask & LUA_MASKRET) { |
| 390 | ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ |
| 391 | luaD_hook(L, LUA_HOOKRET, -1); |
| 392 | firstResult = restorestack(L, fr); |
| 393 | } |
| 394 | L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ |
| 395 | } |
| 396 | res = ci->func; /* res == final position of 1st result */ |
| 397 | L->ci = ci->previous; /* back to caller */ |
| 398 | /* move results to proper place */ |
| 399 | return moveresults(L, firstResult, res, nres, wanted); |
| 400 | } |
| 401 | |
| 402 | |
| 403 |
no test coverage detected