From 43658f9669a5a3566bdf12e81b3793fdecacf4eb Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 7 May 2010 16:02:29 +0500 Subject: prosody: Modified function metatable for better string representation of functions. --- prosody | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'prosody') diff --git a/prosody b/prosody index 0232b83b..e4e82105 100755 --- a/prosody +++ b/prosody @@ -143,6 +143,10 @@ function set_function_metatable() 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 -- cgit v1.2.3