** Fix an expression to return the number of results 'nresults'. ** Either 'e' is a multi-ret expression (function call or vararg) ** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). */
| 520 | ** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). |
| 521 | */ |
| 522 | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { |
| 523 | if (e->k == VCALL) { /* expression is an open function call? */ |
| 524 | SETARG_C(getinstruction(fs, e), nresults + 1); |
| 525 | } |
| 526 | else if (e->k == VVARARG) { |
| 527 | Instruction *pc = &getinstruction(fs, e); |
| 528 | SETARG_B(*pc, nresults + 1); |
| 529 | SETARG_A(*pc, fs->freereg); |
| 530 | luaK_reserveregs(fs, 1); |
| 531 | } |
| 532 | else lua_assert(nresults == LUA_MULTRET); |
| 533 | } |
| 534 | |
| 535 | |
| 536 | /* |
no test coverage detected