Changeset

2524:0404476ecfe3

mod_firewall: More meta() enhancements
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:28:35 +0000
parents 2523:a3a18d09ae8a
children 2525:a35d85cfda92
files mod_firewall/mod_firewall.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Mon Feb 20 09:26:27 2017 +0000
+++ b/mod_firewall/mod_firewall.lua	Mon Feb 20 09:28:35 2017 +0000
@@ -85,8 +85,10 @@
 				else
 					code = "stanza.attr["..("%q"):format(attr_name).."]";
 				end
+			elseif expr:match("^%w+#$") then
+				code = ("stanza:get_child_text(%q)"):format(expr:sub(1, -2));
 			else
-				code = "(stanza:find("..("%q"):format(expr)..") or "..("%q"):format("<undefined>")..")";
+				code = ("stanza:find(%q)"):format(expr);
 			end
 			if func_chain then
 				for func_name in func_chain:gmatch("|(%w+)") do
@@ -111,7 +113,7 @@
 					end
 				end
 			end
-			return "\"..(("..code..") or \"<undefined>\")..\"";
+			return "\"..tostring(("..code..") or \"<undefined>\")..\"";
 		end)
 		:gsub("$$(%a+)", extra or {})
 		:gsub([[^""%.%.]], "")