Changeset

3024:9c74785c6351

prosody: Modified function metatable for better string representation of functions.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 07 May 2010 16:02:29 +0500
parents 3023:454e1cf18daf
children 3025:f1e1b7629807
files prosody
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Fri May 07 16:00:33 2010 +0500
+++ b/prosody	Fri May 07 16:02:29 2010 +0500
@@ -143,6 +143,10 @@
 			debug.setupvalue(f, i, value);
 		end
 	end
+	function mt.__tostring(f)
+		local info = debug.getinfo(f);
+		return ("function(%s:%d)"):format(info.short_src:match("[^\\/]*$"), info.linedefined);
+	end
 	debug.setmetatable(function() end, mt);
 end