diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-05-27 09:35:04 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-05-27 09:35:04 +0200 |
commit | fc47606d8733d2a3f4e9d5eab970efd58e458836 (patch) | |
tree | cfbbdc0c03fb408b562cd0e3bee824cd0bab30b5 /src/lapi.js | |
parent | 3984ff6ea092325bcbc8e4b8593e73cce084586a (diff) | |
download | fengari-fc47606d8733d2a3f4e9d5eab970efd58e458836.tar.gz fengari-fc47606d8733d2a3f4e9d5eab970efd58e458836.tar.bz2 fengari-fc47606d8733d2a3f4e9d5eab970efd58e458836.zip |
lua_tonumber should return 0 if value can't be converted to a number
Diffstat (limited to 'src/lapi.js')
-rw-r--r-- | src/lapi.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lapi.js b/src/lapi.js index 63ed33e..4abe0c2 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -714,7 +714,8 @@ const lua_tointeger = function(L, idx) { }; const lua_tonumber = function(L, idx) { - return lvm.tonumber(index2addr(L, idx)); + let n = lvm.tonumber(index2addr(L, idx)); + return n === false ? 0 : n; }; const lua_touserdata = function(L, idx) { |