| 360 | |
| 361 | |
| 362 | int luaD_poscall (lua_State *L, StkId firstResult) { |
| 363 | StkId res; |
| 364 | int wanted, i; |
| 365 | CallInfo *ci = L->ci; |
| 366 | if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { |
| 367 | if (L->hookmask & LUA_MASKRET) { |
| 368 | ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ |
| 369 | luaD_hook(L, LUA_HOOKRET, -1); |
| 370 | firstResult = restorestack(L, fr); |
| 371 | } |
| 372 | L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ |
| 373 | } |
| 374 | res = ci->func; /* res == final position of 1st result */ |
| 375 | wanted = ci->nresults; |
| 376 | L->ci = ci = ci->previous; /* back to caller */ |
| 377 | /* move results to correct place */ |
| 378 | for (i = wanted; i != 0 && firstResult < L->top; i--) |
| 379 | setobjs2s(L, res++, firstResult++); |
| 380 | while (i-- > 0) |
| 381 | setnilvalue(res++); |
| 382 | L->top = res; |
| 383 | return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ |
| 384 | } |
| 385 | |
| 386 | |
| 387 | /* |
no test coverage detected