From 534a1874b0fcfe70a9377f6c09c2fae0688f53d9 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Tue, 6 Sep 2016 01:58:43 +0200 Subject: [PATCH] backup --- libs/inspect.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/inspect.lua b/libs/inspect.lua index 267ddb6..0ee4c92 100644 --- a/libs/inspect.lua +++ b/libs/inspect.lua @@ -11,13 +11,17 @@ local function format_value(v) end local function print_table(t, max_depth, depth) - local indent = strrep(' ', depth * 4) + local padding = strrep(' ', depth * 4) for k, v in t do - print(indent .. format_key(k) .. ' = ' .. format_value(v)) - if type(v) == 'table' and next(v) and depth < max_depth then - print(indent .. '{') + if depth == max_depth then + print(padding .. '...') + return + end + print(padding .. format_key(k) .. ' = ' .. format_value(v)) + if type(v) == 'table' then + print(padding .. '{') print_table(v, max_depth, depth + 1) - print(indent .. '}') + print(padding .. '}') end end end