renamed "unescape" functions to "escape"

These functions replace raw characters with escape sequences rather than the reverse.
eLua
Kodi Arfer 11 years ago
parent 6373d7748a
commit a5291a2a2c
  1. 10
      inspect.lua

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

Loading…
Cancel
Save