Fri, 07 May 2010 16:02:29 +0500
prosody: Modified function metatable for better string representation of functions.
prosody | file | annotate | diff | comparison | revisions |
--- 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