** Emit a SETLIST instruction. ** 'base' is register that keeps table; ** 'nelems' is #table plus those to be stored now; ** 'tostore' is number of values (in registers 'base + 1',...) to add to ** table (or LUA_MULTRET to add up to stack top). */
| 1766 | ** table (or LUA_MULTRET to add up to stack top). |
| 1767 | */ |
| 1768 | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { |
| 1769 | lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); |
| 1770 | if (tostore == LUA_MULTRET) |
| 1771 | tostore = 0; |
| 1772 | if (nelems <= MAXARG_C) |
| 1773 | luaK_codeABC(fs, OP_SETLIST, base, tostore, nelems); |
| 1774 | else { |
| 1775 | int extra = nelems / (MAXARG_C + 1); |
| 1776 | nelems %= (MAXARG_C + 1); |
| 1777 | luaK_codeABCk(fs, OP_SETLIST, base, tostore, nelems, 1); |
| 1778 | codeextraarg(fs, extra); |
| 1779 | } |
| 1780 | fs->freereg = base + 1; /* free registers with list values */ |
| 1781 | } |
| 1782 | |
| 1783 | |
| 1784 | /* |
no test coverage detected