From 68e02ef7ba78a64216670f1e37a947f12d807a10 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 22 Mar 2012 16:39:28 +0000 Subject: util.debug: Add a touch of colour to source locations --- util/debug.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/debug.lua b/util/debug.lua index 9d76c795..d63dce1b 100644 --- a/util/debug.lua +++ b/util/debug.lua @@ -19,6 +19,7 @@ do filename = _("bright", "blue"); level_num = _("green"); funcname = _("yellow"); + location = _("yellow"); }; end @@ -143,9 +144,9 @@ function debug._traceback(thread, message, level) local source_desc = (info.short_src == "[C]" and "C code") or info.short_src or "Unknown"; if func_type == " " then func_type = ""; end; if info.short_src == "[C]" then - line = "[ C ] "..func_type.."C function "..(info.name and ("%q"):format(info.name) or "(unknown name)") + line = "[ C ] "..func_type.."C function "..getstring(styles.location, (info.name and ("%q"):format(info.name) or "(unknown name)")); elseif info.what == "main" then - line = "[Lua] "..info.short_src.." line "..info.currentline; + line = "[Lua] "..getstring(styles.location, info.short_src.." line "..info.currentline); else local name = info.name or " "; if name ~= " " then @@ -154,7 +155,7 @@ function debug._traceback(thread, message, level) if func_type == "global " or func_type == "local " then func_type = func_type.."function "; end - line = "[Lua] "..info.short_src.." line "..info.currentline.." in "..func_type..getstring(styles.funcname, name).." defined on line "..info.linedefined; + line = "[Lua] "..getstring(styles.location, info.short_src.." line "..info.currentline).." in "..func_type..getstring(styles.funcname, name).." (defined on line "..info.linedefined..")"; end if source_desc ~= last_source_desc then -- Venturing into a new source, add marker for previous if last_source_desc then -- cgit v1.2.3