From 2ffe44e84bfb72f44e4a2a598591cf0ec1c1c704 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 23 Feb 2017 12:40:46 +0100 Subject: Fixed bad lua_gettop --- src/lcorolib.js | 4 ++-- src/lvm.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2