summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-30 16:02:52 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-30 16:02:52 +1000
commite602b73c35b74178a1dc36e4b0d0b442e63264d5 (patch)
treed39036ef867c252150e5a3824cc6caf48d7a1c36 /src/lapi.js
parentaef4fa0614a7984b5382b47302f3248032197d5a (diff)
downloadfengari-e602b73c35b74178a1dc36e4b0d0b442e63264d5.tar.gz
fengari-e602b73c35b74178a1dc36e4b0d0b442e63264d5.tar.bz2
fengari-e602b73c35b74178a1dc36e4b0d0b442e63264d5.zip
Introduce function to adjust L.top
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/lapi.js b/src/lapi.js
index ceafa4a..4b5be04 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -151,13 +151,7 @@ const lua_settop = function(L, idx) {
assert(-(idx + 1) <= L.top - (func + 1), "invalid new top");
newtop = L.top + idx + 1; /* 'subtract' index (index is negative) */
}
- if (L.top < newtop) {
- while (L.top < newtop)
- L.stack[L.top++] = new TValue(CT.LUA_TNIL, null);
- } else {
- while (L.top > newtop)
- delete L.stack[--L.top];
- }
+ ldo.adjust_top(L, newtop);
};
const lua_pop = function(L, n) {