aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xprosody4
1 files changed, 4 insertions, 0 deletions
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