From a5291a2a2cdb1638cd85ff23759f8edf04b07c90 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Tue, 7 Jan 2014 09:00:54 -0500 Subject: [PATCH] renamed "unescape" functions to "escape" These functions replace raw characters with escape sequences rather than the reverse. --- inspect.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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