Changed lume.trace() to round numbers to 2 decimal places

This commit is contained in:
rxi 2014-03-30 18:31:14 +01:00
parent 9bf2d24ee2
commit e6246834b7

View File

@ -308,9 +308,13 @@ end
function lume.trace(...) function lume.trace(...)
local function stringify(x)
x = (type(x) == "number") and lume.round(x, .01) or x
return tostring(x)
end
local info = debug.getinfo(2, "Sl") local info = debug.getinfo(2, "Sl")
local head = "[" .. info.short_src .. ":" .. info.currentline .. "] " local head = "[" .. info.short_src .. ":" .. info.currentline .. "] "
print(head .. table.concat(lume.map({...}, tostring), " ")) print(head .. table.concat(lume.map({...}, stringify), " "))
end end