renamed "unescape" functions to "escape"

These functions replace raw characters with escape sequences rather than the reverse.
This commit is contained in:
Kodi Arfer 2014-01-07 09:00:54 -05:00
parent 6373d7748a
commit a5291a2a2c

View File

@ -42,10 +42,10 @@ local controlCharsTranslation = {
["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v", ["\\"] = "\\\\"
}
local function unescapeChar(c) return controlCharsTranslation[c] end
local function escapeChar(c) return controlCharsTranslation[c] end
local function unescape(str)
local result, _ = string.gsub(str, "(%c)", unescapeChar)
local function escape(str)
local result = string.gsub(str, "(%c)", escapeChar)
return result
end
@ -222,7 +222,7 @@ function inspect.inspect(rootObject, options)
puts('{')
down(function()
if to_string_result then
puts(' -- ', unescape(to_string_result))
puts(' -- ', escape(to_string_result))
if length >= 1 then tabify() end -- tabify the array values
end
@ -268,7 +268,7 @@ function inspect.inspect(rootObject, options)
local tv = type(v)
if tv == 'string' then
puts(smartQuote(unescape(v)))
puts(smartQuote(escape(v)))
elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then
puts(tostring(v))
elseif tv == 'table' then