Software /
code /
prosody
Diff
plugins/mod_admin_telnet.lua @ 10798:b81f4fd7f21a
mod_admin_telnet: Use tostring as fallback in pretty printing
This has some nice effects such as functions, VirtualHosts and other
things being printed using their `__tostring` metamethod.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 May 2020 20:41:35 +0200 |
parent | 10797:1c61ef6a15ab |
child | 10845:785fa0112411 |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Sat May 02 20:39:33 2020 +0200 +++ b/plugins/mod_admin_telnet.lua Sat May 02 20:41:35 2020 +0200 @@ -335,6 +335,10 @@ if type(opts) ~= "table" then opts = { preset = opts }; end + if not opts.fallback then + -- XXX Error message passed to fallback is lost, does it matter? + opts.fallback = tostring; + end for k,v in pairs(serialize_defaults) do if opts[k] == nil then opts[k] = v;