aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-23 12:40:46 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-23 12:47:12 +0100
commit2ffe44e84bfb72f44e4a2a598591cf0ec1c1c704 (patch)
tree3ef6287240366503951d72cb79ee0717e7f740f7 /src
parent6d88293ea029a2372250297bd014b78d40507aa7 (diff)
downloadfengari-2ffe44e84bfb72f44e4a2a598591cf0ec1c1c704.tar.gz
fengari-2ffe44e84bfb72f44e4a2a598591cf0ec1c1c704.tar.bz2
fengari-2ffe44e84bfb72f44e4a2a598591cf0ec1c1c704.zip
Fixed bad lua_gettop
Diffstat (limited to 'src')
-rw-r--r--src/lcorolib.js4
-rw-r--r--src/lvm.js1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/lcorolib.js b/src/lcorolib.js
index b595d4d..32532a6 100644
--- a/src/lcorolib.js
+++ b/src/lcorolib.js
@@ -32,7 +32,7 @@ const auxresume = function(L, co, narg) {
lapi.lua_xmove(L, co, narg);
let status = ldo.lua_resume(co, L, narg);
if (status === TS.LUA_OK || status === TS.LUA_YIELD) {
- let nres = lapi.lua_gettop(L);
+ let nres = lapi.lua_gettop(co);
if (!lapi.lua_checkstack(L, nres + 1)) {
lapi.lua_pop(co, nres); /* remove results anyway */
lapi.lua_pushliteral(L, "too many results to resume");
@@ -123,7 +123,7 @@ const luaB_costatus = function(L) {
};
const luaB_yieldable = function(L) {
- lapi.lua_pushboolean(L, lapi.lua_isyieldable(L));
+ lapi.lua_pushboolean(L, ldo.lua_isyieldable(L));
return 1;
};
diff --git a/src/lvm.js b/src/lvm.js
index 15a11e4..5615acd 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -521,6 +521,7 @@ const luaV_execute = function(L) {
for (let aux = 0; nfuncOff + aux < lim; aux++)
L.stack[ofuncOff + aux] = L.stack[nfuncOff + aux];
oci.func = nci.func;
+ oci.funcOff = nci.funcOff;
oci.u.l.base = ofuncOff + (nci.u.l.base - nfuncOff);
L.top = ofuncOff + (L.top - nfuncOff);
oci.top = L.top;