library refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-10-12 12:58:46 +02:00
parent a26665148d
commit 2e19a90d2d
2 changed files with 31 additions and 29 deletions
+6 -4
View File
@@ -27,17 +27,19 @@ local max_depth
function print_pair(k, v, depth) function print_pair(k, v, depth)
local padding = strrep(' ', depth * 4) local padding = strrep(' ', depth * 4)
if depth == max_depth then
print(padding .. '...')
return
end
print(padding..format_key(k)..' = '..format_value(v)) print(padding..format_key(k)..' = '..format_value(v))
if type(v) == 'table' then if type(v) == 'table' then
if next(v) then
print(padding..'{') print(padding..'{')
if depth == max_depth then
print(padding..' ...')
else
print_table(v, depth + 1) print_table(v, depth + 1)
end
print(padding .. '}') print(padding .. '}')
end end
end end
end
function inspect(_, ...) function inspect(_, ...)
local n = arg.n local n = arg.n