summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lfunc.js1
-rw-r--r--src/lstate.js6
-rw-r--r--src/lvm.js4
3 files changed, 6 insertions, 5 deletions
diff --git a/src/lfunc.js b/src/lfunc.js
index abc87e8..929dae8 100644
--- a/src/lfunc.js
+++ b/src/lfunc.js
@@ -17,7 +17,6 @@ class Proto {
this.linedefined = 0; // debug information
this.lastlinedefined = 0; // debug information
this.source = null; // used for debug information
- this.nresults = 0; // expected number of results from this function
}
}
diff --git a/src/lstate.js b/src/lstate.js
index bf49b42..ef84e07 100644
--- a/src/lstate.js
+++ b/src/lstate.js
@@ -4,8 +4,9 @@
class CallInfo {
- constructor(func, top, base, previous, next) {
+ constructor(funcOff, func, top, base, previous, next) {
this.func = func;
+ this.funcOff = funcOff;
this.top = top;
this.previous = previous;
this.next = next;
@@ -16,6 +17,7 @@ class CallInfo {
savedpc: []
}
};
+ this.nresults = 0;
}
}
@@ -24,7 +26,7 @@ class lua_State {
constructor(cl) {
this.top = 1;
- this.ci = new CallInfo(cl, 1, 1, null, null);
+ this.ci = new CallInfo(0, cl, 1, 1, null, null);
this.ci.u.l.savedpc = cl.p.code;
this.ciOff = 0;
this.stack = [
diff --git a/src/lvm.js b/src/lvm.js
index 155e057..95382b3 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -450,7 +450,7 @@ class LuaVM {
if (L.ci.next) {
L.ci = L.ci.next;
} else {
- ci = new CallInfo();
+ ci = new CallInfo(off);
L.ci.next = ci;
ci.previous = L.ci;
ci.next = null;
@@ -473,7 +473,7 @@ class LuaVM {
postcall(ci, firstResult, nres) {
let wanted = ci.nresults;
- let res = ci.func;
+ let res = ci.funcOff;
this.L.ci = ci.previous;
this.L.ciOff--;
return this.moveresults(firstResult, res, nres, wanted);