comparison mod_firewall/mod_firewall.lua @ 3981:7e8f2e36419d

mod_firewall: Use util.envload instead of deprecated loadstring (thanks Martin) loadstring was deprecated in Lua 5.2 and removed from in 5.3
author Kim Alvefur <zash@zash.se>
date Sun, 19 Apr 2020 23:37:13 +0200
parents b0d92332b87f
children cc20493018f6
comparison
equal deleted inserted replaced
3980:19c5bfc3a241 3981:7e8f2e36419d
1 1
2 local lfs = require "lfs"; 2 local lfs = require "lfs";
3 local resolve_relative_path = require "core.configmanager".resolve_relative_path; 3 local resolve_relative_path = require "core.configmanager".resolve_relative_path;
4 local envload = require "util.envload".envload;
4 local logger = require "util.logger".init; 5 local logger = require "util.logger".init;
5 local it = require "util.iterators"; 6 local it = require "util.iterators";
6 local set = require "util.set"; 7 local set = require "util.set";
7 8
8 -- [definition_type] = definition_factory(param) 9 -- [definition_type] = definition_factory(param)
541 542
542 -- Compile handler code into a factory that produces a valid event handler. Factory accepts 543 -- Compile handler code into a factory that produces a valid event handler. Factory accepts
543 -- a value to be returned on PASS 544 -- a value to be returned on PASS
544 local function compile_handler(code_string, filename) 545 local function compile_handler(code_string, filename)
545 -- Prepare event handler function 546 -- Prepare event handler function
546 local chunk, err = loadstring(code_string, "="..filename); 547 local chunk, err = envload(code_string, "="..filename, _G);
547 if not chunk then 548 if not chunk then
548 return nil, "Error compiling (probably a compiler bug, please report): "..err; 549 return nil, "Error compiling (probably a compiler bug, please report): "..err;
549 end 550 end
550 local function fire_event(name, data) 551 local function fire_event(name, data)
551 return module:fire_event(name, data); 552 return module:fire_event(name, data);