Software /
code /
prosody-modules
Diff
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 |
parent | 2546:6e4494772328 |
child | 2548:ce08a57e516b |
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua Thu Feb 23 13:57:48 2017 +0000 +++ b/mod_firewall/mod_firewall.lua Thu Feb 23 13:58:13 2017 +0000 @@ -125,6 +125,10 @@ :gsub([[%.%.""$]], "")); end +function metaq(s, ...) + return meta(("%q"):format(s), ...); +end + local escape_chars = { a = "\a", b = "\b", f = "\f", n = "\n", r = "\r", t = "\t", v = "\v", ["\\"] = "\\", ["\""] = "\"", ["\'"] = "\'"