changeset 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 f72aa8840042
children 1962c94e2203
files mod_statistics/prosodytop.lib.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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