From e6246834b748decbb9639402191bf10dd54a391d Mon Sep 17 00:00:00 2001 From: rxi Date: Sun, 30 Mar 2014 18:31:14 +0100 Subject: [PATCH] Changed lume.trace() to round numbers to 2 decimal places --- lume.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lume.lua b/lume.lua index f6aeb72..2c7e0c5 100644 --- a/lume.lua +++ b/lume.lua @@ -308,9 +308,13 @@ end 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 head = "[" .. info.short_src .. ":" .. info.currentline .. "] " - print(head .. table.concat(lume.map({...}, tostring), " ")) + print(head .. table.concat(lume.map({...}, stringify), " ")) end