From 9829c2859984e2e64a95392a3c9da18f38fd3302 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 8 May 2017 17:58:08 +1000 Subject: src/lcode.js: Fix nilK using invalid key --- src/lcode.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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); }; /* -- cgit v1.2.3-70-g09d2