Remove redundant `escapeChar` function

`string.gsub` can accept a table as the third argument, no need to wrap it
in a function.
master
mpeterv 10 years ago
parent 54d2c28c7a
commit b2217c6806
  1. 4
      inspect.lua

@ -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

Loading…
Cancel
Save