Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
10797:1c61ef6a15ab | 10798:b81f4fd7f21a |
---|---|
333 def_env.output = {}; | 333 def_env.output = {}; |
334 function def_env.output:configure(opts) | 334 function def_env.output:configure(opts) |
335 if type(opts) ~= "table" then | 335 if type(opts) ~= "table" then |
336 opts = { preset = opts }; | 336 opts = { preset = opts }; |
337 end | 337 end |
338 if not opts.fallback then | |
339 -- XXX Error message passed to fallback is lost, does it matter? | |
340 opts.fallback = tostring; | |
341 end | |
338 for k,v in pairs(serialize_defaults) do | 342 for k,v in pairs(serialize_defaults) do |
339 if opts[k] == nil then | 343 if opts[k] == nil then |
340 opts[k] = v; | 344 opts[k] = v; |
341 end | 345 end |
342 end | 346 end |