aboutsummaryrefslogtreecommitdiff
path: root/src/lvm.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lvm.js')
-rw-r--r--src/lvm.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 7ca6921..bd3e2c4 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -559,6 +559,24 @@ class LuaVM {
break;
}
case "OP_SETLIST": {
+ let n = i.B;
+ let c = i.C;
+
+ if (n === 0) n = L.top - ra - 1;
+
+ if (c === 0) {
+ assert(OC.OpCodes[ci.u.l.savedpc[ci.pcOff].opcode] === "OP_EXTRAARG");
+ c = ci.u.l.savedpc[ci.pcOff++].Ax;
+ }
+
+ let table = L.stack[ra].value;
+ let last = ((c - 1) * OC.LFIELDS_PER_FLUSH) + n;
+
+ for (; n > 0; n--) {
+ table.array[last--] = L.stack[ra + n];
+ }
+
+ L.top = ci.top; /* correct top (in case of previous open call) */
break;
}
case "OP_CLOSURE": {