Mercurial > prosody-hg
comparison 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 |
| parents | 521df71b2630 |
| children | 62c876e333e4 |
comparison
equal
deleted
inserted
replaced
| 9409:521df71b2630 | 9410:7355b2d0067c |
|---|---|
| 1481 end | 1481 end |
| 1482 end | 1482 end |
| 1483 return #stats.." statistics displayed"; | 1483 return #stats.." statistics displayed"; |
| 1484 end | 1484 end |
| 1485 | 1485 |
| 1486 local stats_mt = {__index = stats_methods, __tostring = stats_tostring } | |
| 1486 local function new_stats_context(self) | 1487 local function new_stats_context(self) |
| 1487 return setmetatable({ session = self.session, stats = true }, {__index = stats_methods, __tostring = stats_tostring }); | 1488 return setmetatable({ session = self.session, stats = true }, stats_mt); |
| 1488 end | 1489 end |
| 1489 | 1490 |
| 1490 function def_env.stats:show(filter) | 1491 function def_env.stats:show(filter) |
| 1491 local stats, changed, extra = require "core.statsmanager".get_stats(); | 1492 local stats, changed, extra = require "core.statsmanager".get_stats(); |
| 1492 local available, displayed = 0, 0; | 1493 local available, displayed = 0, 0; |
