From 78144dbdb80d20b8ec48ede1975a0ea5836bc228 Mon Sep 17 00:00:00 2001 From: rxi Date: Fri, 14 Aug 2015 20:27:31 +0100 Subject: [PATCH] Changed lume.trace() to output in a nicer format, updated test --- lume.lua | 4 ++-- test/test_lume.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lume.lua b/lume.lua index dd7413a..ae2dbbe 100644 --- a/lume.lua +++ b/lume.lua @@ -618,11 +618,11 @@ end function lume.trace(...) local info = debug.getinfo(2, "Sl") - local t = { "[" .. info.short_src .. ":" .. info.currentline .. "]" } + local t = { info.short_src .. ":" .. info.currentline .. ":" } for i = 1, select("#", ...) do local x = select(i, ...) if type(x) == "number" then - x = string.format("%g", lume.round(x, .01)) + x = tonumber(lume.round(x, .01)) end t[#t + 1] = tostring(x) end diff --git a/test/test_lume.lua b/test/test_lume.lua index 3f1d350..3cf0efe 100644 --- a/test/test_lume.lua +++ b/test/test_lume.lua @@ -535,7 +535,7 @@ tests["lume.trace"] = function() local oldprint = print local file, line, msg print = function(x) - file, line, msg = x:match("%[(.-):(.-)%] (.*)") + file, line, msg = x:match("(.-):(.-): (.*)") end lume.trace("Hi world", 123.456, 1, nil) print = oldprint