summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-12 08:44:40 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-12 08:46:17 +0200
commit5db1f1f6d5dc1f0e21a0bdf0aae87f3d7aa96fc0 (patch)
treea62ee0e494a5c3850c818490b768fa22489b7ba1 /src
parent4cccf8c6b2c2b1af0afafef52bc87477ba7f817a (diff)
downloadfengari-5db1f1f6d5dc1f0e21a0bdf0aae87f3d7aa96fc0.tar.gz
fengari-5db1f1f6d5dc1f0e21a0bdf0aae87f3d7aa96fc0.tar.bz2
fengari-5db1f1f6d5dc1f0e21a0bdf0aae87f3d7aa96fc0.zip
Boolean TValue should have a boolean value
Diffstat (limited to 'src')
-rw-r--r--src/lcode.js4
-rw-r--r--src/lundump.js2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/lcode.js b/src/lcode.js
index 1235fe4..2887e6d 100644
--- a/src/lcode.js
+++ b/src/lcode.js
@@ -799,8 +799,8 @@ const luaK_exp2RK = function(fs, e) {
let vk = false;
luaK_exp2val(fs, e);
switch (e.k) { /* move constants to 'k' */
- case ek.VTRUE: e.u.info = boolK(fs, 1); vk = true; break;
- case ek.VFALSE: e.u.info = boolK(fs, 0); vk = true; break;
+ case ek.VTRUE: e.u.info = boolK(fs, true); vk = true; break;
+ case ek.VFALSE: e.u.info = boolK(fs, false); vk = true; break;
case ek.VNIL: e.u.info = nilK(fs); vk = true; break;
case ek.VKINT: e.u.info = luaK_intK(fs, e.u.ival); vk = true; break;
case ek.VKFLT: e.u.info = luaK_numberK(fs, e.u.nval); vk = true; break;
diff --git a/src/lundump.js b/src/lundump.js
index 5ea459e..3c35710 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -158,7 +158,7 @@ class BytecodeParser {
f.k.push(new lobject.TValue(defs.CT.LUA_TNIL, null));
break;
case defs.CT.LUA_TBOOLEAN:
- f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte()));
+ f.k.push(new lobject.TValue(defs.CT.LUA_TBOOLEAN, this.readByte() !== 0));
break;
case defs.CT.LUA_TNUMFLT:
f.k.push(new lobject.TValue(defs.CT.LUA_TNUMFLT, this.readNumber()));