From d5a9fbf7123b65ca0eb01e2430be0c3fd2fc313a Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 10 Nov 2008 19:30:58 +0000 Subject: 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 --- lib/format.lua | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3