diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-05-07 16:02:29 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-05-07 16:02:29 +0500 |
commit | 43658f9669a5a3566bdf12e81b3793fdecacf4eb (patch) | |
tree | 43e6086f3faaadf8d9203bb9b4a724443af3299a | |
parent | 5394f55419896520bd65088e5e71078006478e9c (diff) | |
download | prosody-43658f9669a5a3566bdf12e81b3793fdecacf4eb.tar.gz prosody-43658f9669a5a3566bdf12e81b3793fdecacf4eb.zip |
prosody: Modified function metatable for better string representation of functions.
-rwxr-xr-x | prosody | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 |