Changeset

4524:816c319a09d8

util.debug: Add a touch of colour to source locations
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Mar 2012 16:39:28 +0000
parents 4523:d733bde93074
children 4525:e00b4ec5fca4
files util/debug.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/util/debug.lua	Thu Mar 22 16:07:57 2012 +0000
+++ b/util/debug.lua	Thu Mar 22 16:39:28 2012 +0000
@@ -19,6 +19,7 @@
 		filename         = _("bright", "blue");
 		level_num        = _("green");
 		funcname         = _("yellow");
+		location         = _("yellow");
 	};
 end
 
@@ -143,9 +144,9 @@
 		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 @@
 			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