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