Mercurial > prosody-modules
comparison mod_statistics/prosodytop.lib.lua @ 3427:8ea7d8f90d25
mod_statistics: top: Use util.envload for 5.2 compatibility
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 03 Jan 2019 11:57:55 +0000 |
parents | 66bda434d476 |
children | 1962c94e2203 |
comparison
equal
deleted
inserted
replaced
3426:f72aa8840042 | 3427:8ea7d8f90d25 |
---|---|
1 local curses = require "curses"; | 1 local curses = require "curses"; |
2 local server = require "net.server_select"; | 2 local server = require "net.server_select"; |
3 local timer = require "util.timer"; | 3 local timer = require "util.timer"; |
4 local envload = require "util.envload".envload; | |
4 | 5 |
5 assert(curses.timeout, "Incorrect version of curses library. Try 'sudo luarocks install luaposix'"); | 6 assert(curses.timeout, "Incorrect version of curses library. Try 'sudo luarocks install luaposix'"); |
6 | 7 |
7 local top = module:require "top"; | 8 local top = module:require "top"; |
8 | 9 |
73 end end; | 74 end end; |
74 SESS = function (id) return function (jid) return function (stats) | 75 SESS = function (id) return function (jid) return function (stats) |
75 view:update_session(id, jid, stats); | 76 view:update_session(id, jid, stats); |
76 end end end; | 77 end end end; |
77 }; | 78 }; |
78 local chunk = assert(loadstring(line)); | 79 local chunk = assert(envload(line, e)); |
79 setfenv(chunk, e); | |
80 chunk(); | 80 chunk(); |
81 end | 81 end |
82 | 82 |
83 local stats_listener = {}; | 83 local stats_listener = {}; |
84 | 84 |