Mercurial > prosody-modules
diff mod_firewall/conditions.lib.lua @ 6509:f61564e11d3b
various: Adjust for loop variables becoming constants in Lua 5.5
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 07 Apr 2026 14:30:31 +0200 |
| parents | b15601203d0d |
| children | d4da95d6d977 |
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua Tue Apr 07 06:51:05 2026 +0200 +++ b/mod_firewall/conditions.lib.lua Tue Apr 07 14:30:31 2026 +0200 @@ -173,8 +173,8 @@ function condition_handlers.CROSSING_GROUPS(group_names) local code = {}; - for group_name in group_names:gmatch("([^, ][^,]+)") do - group_name = group_name:match("^%s*(.-)%s*$"); -- Trim leading/trailing whitespace + for wgroup_name in group_names:gmatch("([^, ][^,]+)") do + local group_name = wgroup_name:match("^%s*(.-)%s*$"); -- Trim leading/trailing whitespace -- Just check that's it is crossing from outside group to inside group table.insert(code, ("(group_contains(%q, bare_to) and group_contains(%q, bare_from))"):format(group_name, group_name)) end @@ -254,9 +254,9 @@ function condition_handlers.TIME(ranges) local conditions = {}; - for range in ranges:gmatch("([^,]+)") do + for rawrange in ranges:gmatch("([^,]+)") do local clause = {}; - range = range:lower() + local range = rawrange:lower() :gsub("(%d+):?(%d*) *am", function (h, m) return tostring(tonumber(h)%12)..":"..(tonumber(m) or "00"); end) :gsub("(%d+):?(%d*) *pm", function (h, m) return tostring(tonumber(h)%12+12)..":"..(tonumber(m) or "00"); end); local start_hour, start_minute = range:match("(%d+):(%d+) *%-");
