summaryrefslogtreecommitdiff
path: root/src/lcode.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-23 14:34:06 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-23 15:06:35 +1000
commitfe6129f7edaa3a9dee990cd90f765e7196d992b6 (patch)
tree9763dc96a8e589e733f134f28e3277c88f50e387 /src/lcode.js
parentdbb25922aad020bcf898c08e809811641561cd87 (diff)
downloadfengari-fe6129f7edaa3a9dee990cd90f765e7196d992b6.tar.gz
fengari-fe6129f7edaa3a9dee990cd90f765e7196d992b6.tar.bz2
fengari-fe6129f7edaa3a9dee990cd90f765e7196d992b6.zip
src/lcode.js: luaK_intK no longer collides with strings
Diffstat (limited to 'src/lcode.js')
-rw-r--r--src/lcode.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lcode.js b/src/lcode.js
index ea010aa..89813cb 100644
--- a/src/lcode.js
+++ b/src/lcode.js
@@ -470,12 +470,10 @@ const luaK_stringK = function(fs, s) {
/*
** Add an integer to list of constants and return its index.
** Integers use userdata as keys to avoid collision with floats with
-** same value; conversion to 'void*' is used only for hashing, so there
-** are no "precision" problems.
+** same value.
*/
const luaK_intK = function(fs, n) {
- /* FIXME: shouldn't use string as key. need to use pointer */
- let k = new TValue(CT.LUA_TLNGSTR, lstring.luaS_bless(fs.L, defs.to_luastring(`${n}`)));
+ let k = new TValue(CT.LUA_TLIGHTUSERDATA, n);
let o = new TValue(CT.LUA_TNUMINT, n);
return addk(fs, k, o);
};