library refactoring
This commit is contained in:
+6
-4
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user