# HG changeset patch # User Matthew Wild # Date 1365253358 -3600 # Node ID a65df6e97d94bc43806aa37bbab3fb144cbd8cca # Parent d4e24fb289c056e41f23768146a7265f503c678f mod_firewall: Add time and date deps diff -r d4e24fb289c0 -r a65df6e97d94 mod_firewall/mod_firewall.lua --- a/mod_firewall/mod_firewall.lua Fri Apr 05 19:21:46 2013 +0100 +++ b/mod_firewall/mod_firewall.lua Sat Apr 06 14:02:38 2013 +0100 @@ -76,6 +76,14 @@ assert(zone:match("^%a[%w_]*$"), "Invalid zone name: "..zone); return ("local zone_%s = zones[%q] or {};"):format(zone, zone); end }; + date_time = { global_code = [[local os_date = os.date]]; local_code = [[local current_date_time = os_date("*t");]] }; + time = { local_code = function (what) + local defs = {}; + for field in what:gmatch("%a+") do + table.insert(defs, ("local current_%s = current_date_time.%s;"):format(field, field)); + end + return table.concat(defs, " "); + end, depends = { "date_time" }; }; }; local function include_dep(dep, code)