# HG changeset patch # User Matthew Wild # Date 1546516675 0 # Node ID 8ea7d8f90d254e53ca2fde4c9a5108274eadafaf # Parent f72aa88400421d34253274d1f7b0105432ff1131 mod_statistics: top: Use util.envload for 5.2 compatibility diff -r f72aa8840042 -r 8ea7d8f90d25 mod_statistics/prosodytop.lib.lua --- a/mod_statistics/prosodytop.lib.lua Thu Jan 03 12:06:09 2019 +0100 +++ b/mod_statistics/prosodytop.lib.lua Thu Jan 03 11:57:55 2019 +0000 @@ -1,6 +1,7 @@ local curses = require "curses"; local server = require "net.server_select"; local timer = require "util.timer"; +local envload = require "util.envload".envload; assert(curses.timeout, "Incorrect version of curses library. Try 'sudo luarocks install luaposix'"); @@ -75,8 +76,7 @@ view:update_session(id, jid, stats); end end end; }; - local chunk = assert(loadstring(line)); - setfenv(chunk, e); + local chunk = assert(envload(line, e)); chunk(); end