Diff

util/debug.lua @ 4693:7ef4faa056fb

util.debug: Some more magic constant fiddling. Don't ask me.
author Matthew Wild <mwild1@gmail.com>
date Wed, 25 Apr 2012 23:16:37 +0100
parent 4684:dc70c4ffb66d
child 4699:c66179261551
line wrap: on
line diff
--- a/util/debug.lua	Wed Apr 25 23:10:32 2012 +0100
+++ b/util/debug.lua	Wed Apr 25 23:16:37 2012 +0100
@@ -88,9 +88,9 @@
 	for level = start_level, math.huge do
 		local info;
 		if thread then
-			info = debug.getinfo(thread, level);
+			info = debug.getinfo(thread, level+1);
 		else
-			info = debug.getinfo(level);
+			info = debug.getinfo(level+1);
 		end
 		if not info then break; end
 		
@@ -128,13 +128,13 @@
 		if type(message) == "number" then
 			level, message = message, nil;
 		else
-			level = 2;
+			level = 1;
 		end
 	end
 	
 	message = message and (message.."\n") or "";
 	
-	local levels = get_traceback_table(thread, level+2);
+	local levels = get_traceback_table(thread, level+3);
 	
 	local last_source_desc;