MCPcopy Create free account
hub / github.com/PlutoLang/Pluto / luaK_setlist

Function luaK_setlist

src/lcode.cpp:2107–2120  ·  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

2105** table (or LUA_MULTRET to add up to stack top).
2106*/
2107void 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/*

Callers 2

closelistfieldFunction · 0.85
lastlistfieldFunction · 0.85

Calls 2

luaK_codevABCkFunction · 0.85
codeextraargFunction · 0.85

Tested by

no test coverage detected