diff --git a/inspect.lua b/inspect.lua index ed6fa52..af9ef56 100644 --- a/inspect.lua +++ b/inspect.lua @@ -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