diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-04-10 08:36:56 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-10 08:36:56 +0200 |
commit | 6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a (patch) | |
tree | 50fbcbd81a905f440767bfa73dec1a70c2b2f8d0 | |
parent | ea6717c46d26dfaded112b4f0bb9c7639ad8c337 (diff) | |
download | fengari-6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a.tar.gz fengari-6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a.tar.bz2 fengari-6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a.zip |
Use luaO_str2num instead of parseFloat in luaB_tonumber
-rw-r--r-- | src/lapi.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lapi.js b/src/lapi.js index a7d7033..3fbcee9 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -678,8 +678,7 @@ const lua_compare_ = function(L, o1, o2, op) { }; const lua_stringtonumber = function(L, s) { - let number = parseFloat(lobject.jsstring(s)); - L.stack[L.top++] = new TValue(number % 1 !== 0 ? CT.LUA_TNUMFLT : CT.LUA_TNUMINT, number); + L.stack[L.top++] = lobject.luaO_str2num(s); assert(L.top <= L.ci.top, "stack overflow"); return s.length; }; |