aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-08 17:58:08 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-08 18:23:06 +1000
commit9829c2859984e2e64a95392a3c9da18f38fd3302 (patch)
tree8d89f10ef956bafb9e6f5f60ff31602b1c28de5d /src
parent767dfd4196106b6ecb45a5253030778100cb1bc4 (diff)
downloadfengari-9829c2859984e2e64a95392a3c9da18f38fd3302.tar.gz
fengari-9829c2859984e2e64a95392a3c9da18f38fd3302.tar.bz2
fengari-9829c2859984e2e64a95392a3c9da18f38fd3302.zip
src/lcode.js: Fix nilK using invalid key
Diffstat (limited to 'src')
-rw-r--r--src/lcode.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lcode.js b/src/lcode.js
index 8d903a6..0ce7526 100644
--- a/src/lcode.js
+++ b/src/lcode.js
@@ -543,7 +543,10 @@ const boolK = function(fs, b) {
** Add nil to list of constants and return its index.
*/
const nilK = function(fs) {
- return addk(fs, new TValue(CT.LUA_TLNGSTR, defs.to_luastring(`null`)), new TValue(CT.LUA_TNIL, null));
+ let v = new TValue(CT.LUA_TNIL, null);
+ let k = new TValue(CT.LUA_TTABLE, fs.ls.h);
+ /* cannot use nil as key; instead use table itself to represent nil */
+ return addk(fs, k, v);
};
/*