From 0303fec453c9ad3775f55b737d8e4f62d259f259 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Tue, 7 Jan 2014 09:21:59 -0500 Subject: [PATCH] tweaked string escaping, fixing GH-9 --- inspect.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inspect.lua b/inspect.lua index c620fec..53498fc 100644 --- a/inspect.lua +++ b/inspect.lua @@ -34,7 +34,7 @@ local function smartQuote(str) if string.match( string.gsub(str,"[^'\"]",""), '^"+$' ) then return "'" .. str .. "'" end - return string.format("%q", str ) + return string.format("%q", str ):gsub("\\\n", "\n") end local controlCharsTranslation = { @@ -268,7 +268,7 @@ function inspect.inspect(rootObject, options) local tv = type(v) if tv == 'string' then - puts(smartQuote(escape(v))) + puts(escape(smartQuote(v))) elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then puts(tostring(v)) elseif tv == 'table' then