** 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). */
| 513 | ** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). |
| 514 | */ |
| 515 | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { |
| 516 | if (e->k == VCALL) { /* expression is an open function call? */ |
| 517 | SETARG_C(getinstruction(fs, e), nresults + 1); |
| 518 | } |
| 519 | else if (e->k == VVARARG) { |
| 520 | Instruction *pc = &getinstruction(fs, e); |
| 521 | SETARG_B(*pc, nresults + 1); |
| 522 | SETARG_A(*pc, fs->freereg); |
| 523 | luaK_reserveregs(fs, 1); |
| 524 | } |
| 525 | else lua_assert(nresults == LUA_MULTRET); |
| 526 | } |
| 527 | |
| 528 | |
| 529 | /* |
no test coverage detected