summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lapi.js2
-rw-r--r--src/lbaselib.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 1fb8baa..d2f5c95 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -800,7 +800,7 @@ const lua_stringtonumber = function(L, s) {
if (tv) {
L.stack[L.top++] = tv;
assert(L.top <= L.ci.top, "stack overflow");
- return s.length;
+ return s.length+1;
}
return 0;
};
diff --git a/src/lbaselib.js b/src/lbaselib.js
index bffe5a6..613adc0 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -162,7 +162,7 @@ const luaB_tonumber = function(L) {
return 1;
} else {
let s = lua.lua_tostring(L, 1);
- if (s !== null && lua.lua_stringtonumber(L, s) === s.length)
+ if (s !== null && lua.lua_stringtonumber(L, s) === s.length+1)
return 1; /* successful conversion to number */
}
} else {