summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lapi.js3
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) {