From 03b285fc261314057ef6cfec7efbf97aa70a9275 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 30 Sep 2018 14:55:15 +0200 Subject: mod_admin_telnet: Create metatable only once --- plugins/mod_admin_telnet.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 41595540..85fb0d6c 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -1483,8 +1483,9 @@ local function stats_tostring(stats) 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) -- cgit v1.2.3