# HG changeset patch # User jbe # Date 1452619420 -3600 # Node ID 8b8ebcb870342996d3110a48de830311347494e9 # Parent 05e56ca2f3244505e6947c66a89d23cb1b640a63 Bugfix in mondelefant_atom_connector: Properly handle big numbers (integer and non-integer) diff -r 05e56ca2f324 -r 8b8ebcb87034 libraries/mondelefant/mondelefant_atom_connector.lua --- a/libraries/mondelefant/mondelefant_atom_connector.lua Sat Jan 09 19:40:39 2016 +0100 +++ b/libraries/mondelefant/mondelefant_atom_connector.lua Tue Jan 12 18:23:40 2016 +0100 @@ -43,11 +43,16 @@ end input_converters["number"] = function(conn, value) - local str = tostring(value) - if string.find(str, "^[0-9%.e%-]+$") then - return str + local integer_string = string.format("%i", value) + if tonumber(integer_string) == value then + return integer_string else - return "'NaN'" + local number_string = tostring(value) + if string.find(number_string, "^[0-9.e+-]+$") then + return number_string + else + return "'NaN'" + end end end