From d49b9bc2abb50b22ae3d6739d96423e9dadfeda8 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Fri, 8 Jun 2012 05:04:38 +0200 Subject: Eliminate direct setfenv usage --- core/moduleapi.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'core/moduleapi.lua') diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 24d29dfe..2bcf9b84 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -17,7 +17,7 @@ local timer = require "util.timer"; local multitable_new = require "util.multitable".new; local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; -local error, setmetatable, setfenv, type = error, setmetatable, setfenv, type; +local error, setmetatable, type = error, setmetatable, type; local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack; local tonumber, tostring = tonumber, tostring; @@ -99,12 +99,11 @@ end api.hook_stanza = api.hook_tag; -- COMPAT w/pre-0.9 function api:require(lib) - local f, n = pluginloader.load_code(self.name, lib..".lib.lua"); + local f, n = pluginloader.load_code(self.name, lib..".lib.lua", self.environment); if not f then - f, n = pluginloader.load_code(lib, lib..".lib.lua"); + f, n = pluginloader.load_code(lib, lib..".lib.lua", self.environment); end if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message - setfenv(f, self.environment); return f(); end -- cgit v1.2.3