Comparison

plugins/mod_admin_telnet.lua @ 10797:1c61ef6a15ab

mod_admin_telnet: Don't pretty-print the normal console stuff Typing e.g. `c2s` would dump out a bunch of stuff that would probably just confuse users. Now you only get pretty-printing when poking around in the internals with `>`.
author Kim Alvefur <zash@zash.se>
date Sat, 02 May 2020 20:39:33 +0200
parent 10796:89d810a23ee0
child 10798:b81f4fd7f21a
comparison
equal deleted inserted replaced
10796:89d810a23ee0 10797:1c61ef6a15ab
143 end 143 end
144 144
145 local taskok, message = chunk(); 145 local taskok, message = chunk();
146 146
147 if not message then 147 if not message then
148 if type(taskok) ~= "string" then 148 if type(taskok) ~= "string" and useglobalenv then
149 taskok = session.serialize(taskok); 149 taskok = session.serialize(taskok);
150 end 150 end
151 session.print("Result: "..taskok); 151 session.print("Result: "..tostring(taskok));
152 return; 152 return;
153 elseif (not taskok) and message then 153 elseif (not taskok) and message then
154 session.print("Command completed with a problem"); 154 session.print("Command completed with a problem");
155 session.print("Message: "..tostring(message)); 155 session.print("Message: "..tostring(message));
156 return; 156 return;
157 end 157 end
158 158
159 if type(message) ~= "string" then 159 session.print("OK: "..tostring(message));
160 message = session.serialize(message);
161 end
162
163 session.print("OK: "..message);
164 end 160 end
165 161
166 local sessions = {}; 162 local sessions = {};
167 163
168 function console_listener.onconnect(conn) 164 function console_listener.onconnect(conn)