Comparison

mod_firewall/mod_firewall.lua @ 2525:a35d85cfda92

mod_firewall: Fix for deps dynamically including deps
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:29:09 +0000
parent 2524:0404476ecfe3
child 2526:b2fc41001c8e
comparison
equal deleted inserted replaced
2524:0404476ecfe3 2525:a35d85cfda92
218 for _, dep_dep in ipairs(dep_info.depends or {}) do 218 for _, dep_dep in ipairs(dep_info.depends or {}) do
219 include_dep(dep_dep, code); 219 include_dep(dep_dep, code);
220 end 220 end
221 if dep_info.global_code then 221 if dep_info.global_code then
222 if dep_param ~= "" then 222 if dep_param ~= "" then
223 table.insert(code.global_header, dep_info.global_code(dep_param)); 223 local global_code, deps = dep_info.global_code(dep_param);
224 if deps then
225 for _, dep in ipairs(deps) do
226 include_dep(dep, code);
227 end
228 end
229 table.insert(code.global_header, global_code);
224 else 230 else
225 table.insert(code.global_header, dep_info.global_code); 231 table.insert(code.global_header, dep_info.global_code);
226 end 232 end
227 end 233 end
228 if dep_info.local_code then 234 if dep_info.local_code then
229 if dep_param ~= "" then 235 if dep_param ~= "" then
230 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code(dep_param).."\n"); 236 local local_code, deps = dep_info.local_code(dep_param);
237 if deps then
238 for _, dep in ipairs(deps) do
239 include_dep(dep, code);
240 end
241 end
242 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..local_code.."\n");
231 else 243 else
232 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code.."\n"); 244 table.insert(code, "\n\t\t-- "..dep.."\n\t\t"..dep_info.local_code.."\n");
233 end 245 end
234 end 246 end
235 code.included_deps[dep] = true; 247 code.included_deps[dep] = true;