Lua round() fix (tonumber returning nil), removed duplicated round() definition

This commit is contained in:
Alfredo Cardigliano 2018-11-30 12:00:00 +01:00
parent 356be040fc
commit 1691a1dd57
2 changed files with 1 additions and 7 deletions

View file

@ -6,7 +6,7 @@ local format_utils = {}
function format_utils.round(num, idp)
if(num == nil) then return(0) end
return tonumber(string.format("%." .. (idp or 0) .. "f", num))
return tonumber(string.format("%." .. (idp or 0) .. "f", num)) or 0
end
local round = format_utils.round