Remove redundant escapeChar function

`string.gsub` can accept a table as the third argument, no need to wrap it
in a function.
This commit is contained in:
mpeterv 2014-11-18 19:42:53 +03:00
parent 54d2c28c7a
commit b2217c6806

View File

@ -45,10 +45,8 @@ local controlCharsTranslation = {
["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v"
}
local function escapeChar(c) return controlCharsTranslation[c] end
local function escape(str)
local result = str:gsub("\\", "\\\\"):gsub("(%c)", escapeChar)
local result = str:gsub("\\", "\\\\"):gsub("(%c)", controlCharsTranslation)
return result
end