From 2b3a4790759168c4f17129f719f96f63a2c6765b Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 9 May 2017 15:19:26 +0200 Subject: lvm.tonumber should return the integer value --- src/lvm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lvm.js b/src/lvm.js index eba7d38..376e64e 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -859,8 +859,10 @@ const tonumber = function(v) { if (v.ttnov() === CT.LUA_TNUMBER) return v.value; - if (v.ttnov() === CT.LUA_TSTRING) - return lobject.luaO_str2num(v.svalue()); + if (v.ttnov() === CT.LUA_TSTRING) { + let number = lobject.luaO_str2num(v.svalue()); + return number ? number.value : false; + } return false; }; -- cgit v1.2.3-70-g09d2