MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaK_setlist

Function luaK_setlist

depends/lua/src/lcode.c:1189–1202  ·  view source on GitHub ↗

** 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). */

Source from the content-addressed store, hash-verified

1187** table (or LUA_MULTRET to add up to stack top).
1188*/
1189void 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

Callers 2

closelistfieldFunction · 0.85
lastlistfieldFunction · 0.85

Calls 3

luaK_codeABCFunction · 0.85
codeextraargFunction · 0.85
luaX_syntaxerrorFunction · 0.85

Tested by

no test coverage detected