From 823345b8b4de9e2a646dbcd471e05a1c7598d378 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Tue, 2 Jun 2015 15:14:31 +0200 Subject: Compress decimal escapes for string.format("%q"). Lua 5.2+ escape all control characters using decimal escape sequences. The previous code did the same but always used three decimals (possibly zero-padded) no matter the following character. The new version only uses all three decimals when another decimal character is following. --- tests/test.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test.lua b/tests/test.lua index f8fa894..9ac27d4 100755 --- a/tests/test.lua +++ b/tests/test.lua @@ -505,7 +505,7 @@ do return _tostring(v) end end - print("string.format()", string.format("%q", "\"\\\0000\0010\r0\n0\t0\"")) + print("string.format()", string.format("%q", "\"\\\0000\0010\002\r\n0\t0\"")) print("string.format()", string.format("%12.3fx%%sxx%.6s", 3.1, {})) print("string.format()", string.format("%-3f %%%s %%s", 3.1, true)) print("string.format()", string.format("% 3.2g %%d %%%s", 3.1, nil)) -- cgit v1.2.3-55-g6feb