summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-10 08:36:56 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-10 08:36:56 +0200
commit6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a (patch)
tree50fbcbd81a905f440767bfa73dec1a70c2b2f8d0 /src
parentea6717c46d26dfaded112b4f0bb9c7639ad8c337 (diff)
downloadfengari-6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a.tar.gz
fengari-6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a.tar.bz2
fengari-6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a.zip
Use luaO_str2num instead of parseFloat in luaB_tonumber
Diffstat (limited to 'src')
-rw-r--r--src/lapi.js3
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;
};