# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1588444895 -7200
# Node ID b81f4fd7f21a6867134938dcec4a03faedaf344f
# Parent  1c61ef6a15ab4948f0b2eac947dabba6867b1586
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.

diff -r 1c61ef6a15ab -r b81f4fd7f21a plugins/mod_admin_telnet.lua
--- 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;