diff options
author | Benoit Giannangeli <giann@users.noreply.github.com> | 2017-05-23 07:58:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-23 07:58:09 +0200 |
commit | 412b24a06c681a03ab1c1f84e00142cab40bf602 (patch) | |
tree | a8be2dfdf82a0b5a02da52cb08175c2b1f3698b9 /src/lcode.js | |
parent | b2fb7a9302693fe5e164469eedb802b54e460347 (diff) | |
parent | beb5d0abd707c112953719a8ac077dff88a5ecf7 (diff) | |
download | fengari-412b24a06c681a03ab1c1f84e00142cab40bf602.tar.gz fengari-412b24a06c681a03ab1c1f84e00142cab40bf602.tar.bz2 fengari-412b24a06c681a03ab1c1f84e00142cab40bf602.zip |
Merge pull request #64 from daurnimator/lightuserdata-keys
Fix collisions with lightuserdata table keys
Diffstat (limited to 'src/lcode.js')
-rw-r--r-- | src/lcode.js | 6 |
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); }; |