Commit a4df0ab6 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

allow returning nil from module event functions

parent 06774cfa
...@@ -122,9 +122,11 @@ function Config:init(policyconfig) ...@@ -122,9 +122,11 @@ function Config:init(policyconfig)
local r = events[event].rules local r = events[event].rules
if r then if r then
if type(r) == 'function' then r = r(self.objects) end if type(r) == 'function' then r = r(self.objects) end
if r then
assert(type(r) == 'table') assert(type(r) == 'table')
insertrules(r) insertrules(r)
end end
end
elseif self.objects[event] then elseif self.objects[event] then
for i, rule in ipairs(self.objects[event]) do for i, rule in ipairs(self.objects[event]) do
insertrules(rule:trules()) insertrules(rule:trules())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment