From b3c87776e08f546a9994527f7c2c7fc4ec07d9a1 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 23 May 2017 17:09:03 +1000 Subject: Introduce setobjs2s --- src/ldebug.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ldebug.js') diff --git a/src/ldebug.js b/src/ldebug.js index 0f387af..0231e67 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -155,7 +155,7 @@ const lua_setlocal = function(L, ar, n) { let name = local.name; let pos = local.pos; if (name) { - L.stack[pos] = L.stack[L.top - 1]; + lobject.setobjs2s(L, pos, L.top - 1); delete L.stack[--L.top]; /* pop value */ } swapextra(L); @@ -280,7 +280,8 @@ const lua_getinfo = function(L, what, ar) { cl = func.ttisclosure() ? func.value : null; status = auxgetinfo(L, what, ar, cl, ci); if (what.indexOf('f'.charCodeAt(0)) >= 0) { - L.stack[L.top++] = func; + lobject.setobjs2s(L, L.top, funcOff); + L.top++; assert(L.top <= L.ci.top, "stack overflow"); } @@ -590,8 +591,8 @@ const luaG_runerror = function(L, fmt, ...argp) { const luaG_errormsg = function(L) { if (L.errfunc !== 0) { /* is there an error handling function? */ let errfunc = L.errfunc; - L.stack[L.top] = L.stack[L.top - 1]; - L.stack[L.top - 1] = L.stack[errfunc]; + lobject.setobjs2s(L, L.top, L.top - 1); /* move argument */ + lobject.setobjs2s(L, L.top - 1, errfunc); /* push function */ L.top++; ldo.luaD_callnoyield(L, L.top - 2, 1); } -- cgit v1.2.3-54-g00ecf