MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaK_setlist

Function luaK_setlist

libraries/AP_Scripting/lua/src/lcode.c:1196–1209  ·  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

1194** table (or LUA_MULTRET to add up to stack top).
1195*/
1196void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
1197 int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1;
1198 int b = (tostore == LUA_MULTRET) ? 0 : tostore;
1199 lua_assert(tostore != 0 && tostore <= LFIELDS_PER_FLUSH);
1200 if (c <= MAXARG_C)
1201 luaK_codeABC(fs, OP_SETLIST, base, b, c);
1202 else if (c <= MAXARG_Ax) {
1203 luaK_codeABC(fs, OP_SETLIST, base, b, 0);
1204 codeextraarg(fs, c);
1205 }
1206 else
1207 luaX_syntaxerror(fs->ls, "constructor too long");
1208 fs->freereg = base + 1; /* free registers with list values */
1209}
1210

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