diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-12 13:45:10 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-12 14:37:53 +1100 |
commit | c5b39b9d292c1a2178aa41c6a95367a81614eb61 (patch) | |
tree | 26c9c9d983e70704becc1e85e1371b1be8bae371 /src/lvm.js | |
parent | 8dfdad3ee84a73ec7da2312e8c8d893dd8968d17 (diff) | |
download | fengari-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.js | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; } |