Mercurial > prosody-modules
comparison mod_firewall/mod_firewall.lua @ 2547:eb4f45bd7fef
mod_firewall: Add metaq(), like meta() but takes an unquoted string
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 23 Feb 2017 13:58:13 +0000 |
parents | 6e4494772328 |
children | ce08a57e516b |
comparison
equal
deleted
inserted
replaced
2546:6e4494772328 | 2547:eb4f45bd7fef |
---|---|
123 :gsub("$$(%a+)", extra or {}) | 123 :gsub("$$(%a+)", extra or {}) |
124 :gsub([[^""%.%.]], "") | 124 :gsub([[^""%.%.]], "") |
125 :gsub([[%.%.""$]], "")); | 125 :gsub([[%.%.""$]], "")); |
126 end | 126 end |
127 | 127 |
128 function metaq(s, ...) | |
129 return meta(("%q"):format(s), ...); | |
130 end | |
131 | |
128 local escape_chars = { | 132 local escape_chars = { |
129 a = "\a", b = "\b", f = "\f", n = "\n", r = "\r", t = "\t", | 133 a = "\a", b = "\b", f = "\f", n = "\n", r = "\r", t = "\t", |
130 v = "\v", ["\\"] = "\\", ["\""] = "\"", ["\'"] = "\'" | 134 v = "\v", ["\\"] = "\\", ["\""] = "\"", ["\'"] = "\'" |
131 }; | 135 }; |
132 function stripslashes(s) | 136 function stripslashes(s) |