summaryrefslogtreecommitdiff
path: root/src/lvm.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-12 13:45:10 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-12 14:37:53 +1100
commitc5b39b9d292c1a2178aa41c6a95367a81614eb61 (patch)
tree26c9c9d983e70704becc1e85e1371b1be8bae371 /src/lvm.js
parent8dfdad3ee84a73ec7da2312e8c8d893dd8968d17 (diff)
downloadfengari-c5b39b9d292c1a2178aa41c6a95367a81614eb61.tar.gz
fengari-c5b39b9d292c1a2178aa41c6a95367a81614eb61.tar.bz2
fengari-c5b39b9d292c1a2178aa41c6a95367a81614eb61.zip
src/: Have luaO_str2num fill in passed TValue and return length
Diffstat (limited to 'src/lvm.js')
-rw-r--r--src/lvm.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 8cc95b3..3cdccb9 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -762,8 +762,8 @@ const luaV_tointeger = function(obj, mode) {
} else if (obj.ttisinteger()) {
return obj.value;
} else if (cvt2num(obj)) {
- let v = lobject.luaO_str2num(obj.svalue());
- if (v !== false)
+ let v = new lobject.TValue();
+ if (lobject.luaO_str2num(obj.svalue(), v) === (obj.vslen() + 1))
return luaV_tointeger(v, mode);
}
@@ -778,9 +778,9 @@ const tonumber = function(o) {
if (o.ttnov() === CT.LUA_TNUMBER)
return o.value;
- if (cvt2num(o)) { /* string convertible to number? */
- let v = lobject.luaO_str2num(o.svalue());
- if (v !== false)
+ if (cvt2num(o)) { /* string convertible to number? */
+ let v = new lobject.TValue();
+ if (lobject.luaO_str2num(o.svalue(), v) === (o.vslen() + 1))
return v.value;
}