From 38fa416ad1924ddd6706c16bf535b1e642522028 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 22 Mar 2015 14:04:03 -0400 Subject: [PATCH] Lua: Indent array values --- library/lua/json/internal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/lua/json/internal.lua b/library/lua/json/internal.lua index 3743d9d7e..35f50e35f 100644 --- a/library/lua/json/internal.lua +++ b/library/lua/json/internal.lua @@ -878,7 +878,8 @@ function encode_value(self, value, parents, etc, options, indent) end if options.pretty then - result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" + local array_indent = indent .. tostring(options.indent or "") + result_value = "[\n" .. array_indent .. table.concat(ITEMS, ",\n" .. array_indent) .. "\n" .. indent .. "]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end