Diff

plugins/mod_admin_telnet.lua @ 9410:7355b2d0067c

mod_admin_telnet: Create metatable only once
author Kim Alvefur <zash@zash.se>
date Sun, 30 Sep 2018 14:55:15 +0200
parent 9409:521df71b2630
child 9411:62c876e333e4
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Sun Sep 30 14:54:51 2018 +0200
+++ b/plugins/mod_admin_telnet.lua	Sun Sep 30 14:55:15 2018 +0200
@@ -1483,8 +1483,9 @@
 	return #stats.." statistics displayed";
 end
 
+local stats_mt = {__index = stats_methods, __tostring = stats_tostring }
 local function new_stats_context(self)
-	return setmetatable({ session = self.session, stats = true }, {__index = stats_methods, __tostring = stats_tostring });
+	return setmetatable({ session = self.session, stats = true }, stats_mt);
 end
 
 function def_env.stats:show(filter)