diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-09 17:02:31 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-09 17:10:18 +1000 |
commit | 3e439ed653093e6e124a4997f64053164f1043b8 (patch) | |
tree | 3ed7655d34183464523c4cbd8472970f1df37605 /src/lapi.js | |
parent | 3f2f887666b49b81f9e9b5dbebaeca0fc3543a3c (diff) | |
download | fengari-3e439ed653093e6e124a4997f64053164f1043b8.tar.gz fengari-3e439ed653093e6e124a4997f64053164f1043b8.tar.bz2 fengari-3e439ed653093e6e124a4997f64053164f1043b8.zip |
src/lapi.js: lobject.luaO_str2num returns false if string is not a number
Diffstat (limited to 'src/lapi.js')
-rw-r--r-- | src/lapi.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lapi.js b/src/lapi.js index e035aca..307d4e3 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -731,9 +731,13 @@ const lua_compare = function(L, index1, index2, op) { }; const lua_stringtonumber = function(L, s) { - L.stack[L.top++] = lobject.luaO_str2num(s); - assert(L.top <= L.ci.top, "stack overflow"); - return s.length; + let tv = lobject.luaO_str2num(s); + if (tv) { + L.stack[L.top++] = tv; + assert(L.top <= L.ci.top, "stack overflow"); + return s.length; + } + return 0; }; const lua_tointegerx = function(L, idx) { |