** 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). */
| 2105 | ** table (or LUA_MULTRET to add up to stack top). |
| 2106 | */ |
| 2107 | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { |
| 2108 | lua_assert(tostore != 0); |
| 2109 | if (tostore == LUA_MULTRET) |
| 2110 | tostore = 0; |
| 2111 | if (nelems <= MAXARG_vC) |
| 2112 | luaK_codevABCk(fs, OP_SETLIST, base, tostore, nelems, 0); |
| 2113 | else { |
| 2114 | int extra = nelems / (MAXARG_vC + 1); |
| 2115 | nelems %= (MAXARG_vC + 1); |
| 2116 | luaK_codevABCk(fs, OP_SETLIST, base, tostore, nelems, 1); |
| 2117 | codeextraarg(fs, extra); |
| 2118 | } |
| 2119 | fs->freereg = cast_byte(base + 1); /* free registers with list values */ |
| 2120 | } |
| 2121 | |
| 2122 | |
| 2123 | /* |
no test coverage detected