From 6257b9cf5ea6a9fed6fd0849182cc15ed1e57c7a Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 10 Apr 2017 08:36:56 +0200 Subject: Use luaO_str2num instead of parseFloat in luaB_tonumber --- src/lapi.js | 3 +-- 1 file changed, 1 insertion(+), 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; }; -- cgit v1.2.3-70-g09d2