diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-22 18:06:40 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-22 18:46:30 +1000 |
commit | 91e09ea32148c34965809b8d69987d439d389870 (patch) | |
tree | 216ca00cad9be1eb1f85c2bdca90ad99f1a28c12 /src/lstate.js | |
parent | 6646bebd474b95a2d4cbb8558c0d1cb5b5353de0 (diff) | |
download | fengari-91e09ea32148c34965809b8d69987d439d389870.tar.gz fengari-91e09ea32148c34965809b8d69987d439d389870.tar.bz2 fengari-91e09ea32148c34965809b8d69987d439d389870.zip |
Compare allowed stack indices to stack_last
Not L.stack.length which is more equivalent to C's L->stacksize
Diffstat (limited to 'src/lstate.js')
-rw-r--r-- | src/lstate.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lstate.js b/src/lstate.js index 5481f95..b71e011 100644 --- a/src/lstate.js +++ b/src/lstate.js @@ -49,7 +49,8 @@ class lua_State { this.base_ci = new CallInfo(); // Will be populated later this.top = 0; this.ci = null; - this.stack = []; + this.stack = null; + this.stack_last = NaN; this.openupval = null; this.status = TS.LUA_OK; this.next = null; @@ -86,8 +87,10 @@ const luaE_extendCI = function(L) { }; const stack_init = function(L1, L) { - L1.stack = new Array(BASIC_STACK_SIZE); // TODO: for now we don't care about the stack size + L1.stack = new Array(BASIC_STACK_SIZE); L1.top = 0; + L1.stack_last = BASIC_STACK_SIZE - EXTRA_STACK; + /* initialize first ci */ let ci = L1.base_ci; ci.next = ci.previous = null; ci.callstatus = 0; |