aboutsummaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
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) {