summaryrefslogtreecommitdiffstats
path: root/lib/format.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-11-10 19:30:58 +0000
committerTed Trask <ttrask01@yahoo.com>2008-11-10 19:30:58 +0000
commitd5a9fbf7123b65ca0eb01e2430be0c3fd2fc313a (patch)
treed8d2e9eb7b0105aeb08677e45641c67ebf129d00 /lib/format.lua
parent88cbca04a9057d1ee14ad1083a1095f73794620b (diff)
downloadacf-core-d5a9fbf7123b65ca0eb01e2430be0c3fd2fc313a.tar.bz2
acf-core-d5a9fbf7123b65ca0eb01e2430be0c3fd2fc313a.tar.xz
Modified format to add escapemagiccharacter functions to escape Lua magic characters in a string.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1587 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/format.lua')
-rw-r--r--lib/format.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/format.lua b/lib/format.lua
index b529470..92f5a62 100644
--- a/lib/format.lua
+++ b/lib/format.lua
@@ -13,6 +13,10 @@ function dostounix ( str )
return data
end
+function escapemagiccharacters ( str )
+ return string.gsub(str, "[%(%)%.%%%+%-%*%?%[%]%^%$]", "%%%1")
+end
+
-- search and remove all blank and commented lines from a string or table of lines
-- returns a table to iterate over without the blank or commented lines