summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-24 12:23:30 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-03-24 12:23:30 +0100
commitf893be002aebd215b499b0c72803dd1346f4eb05 (patch)
treea2c83ccfacfb50e3dd1487e2d8b7562fafc4bb5c /src/lobject.js
parent16cdb860e9e8e5550c1178a41eabb52e461ffa46 (diff)
downloadfengari-f893be002aebd215b499b0c72803dd1346f4eb05.tar.gz
fengari-f893be002aebd215b499b0c72803dd1346f4eb05.tar.bz2
fengari-f893be002aebd215b499b0c72803dd1346f4eb05.zip
Fixed bad lua_tointegerx
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lobject.js b/src/lobject.js
index 3cbde26..bdbccb9 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -342,7 +342,8 @@ const l_str2dloc = function(s, mode) {
};
const l_str2d = function(s) {
- let pidx = /[.xXnN]/g.exec(s).index;
+ let pidx = /[.xXnN]/g.exec(s);
+ pidx = pidx ? pidx.index : null;
let pmode = pidx ? s[pidx] : null;
let mode = pmode ? pmode.toLowerCase() : 0;
if (mode === 'n') /* reject 'inf' and 'nan' */