** 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). */
| 1187 | ** table (or LUA_MULTRET to add up to stack top). |
| 1188 | */ |
| 1189 | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { |
| 1190 | int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; |
| 1191 | int b = (tostore == LUA_MULTRET) ? 0 : tostore; |
| 1192 | lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH); |
| 1193 | if (c <= MAXARG_C) |
| 1194 | luaK_codeABC(fs, OP_SETLIST, base, b, c); |
| 1195 | else if (c <= MAXARG_Ax) { |
| 1196 | luaK_codeABC(fs, OP_SETLIST, base, b, 0); |
| 1197 | codeextraarg(fs, c); |
| 1198 | } |
| 1199 | else |
| 1200 | luaX_syntaxerror(fs->ls, "constructor too long"); |
| 1201 | fs->freereg = base + 1; /* free registers with list values */ |
| 1202 | } |
| 1203 |
no test coverage detected