tm.dump
tm.dump(value, depth?) turns any value into readable text for logs. Shared.
lua
print(tm.dump({ a = 1, list = { 'x', 'y' } }))
-- {
-- ["a"] = 1,
-- ["list"] = {
-- [1] = x,
-- [2] = y,
-- },
-- }- Keys are sorted (numbers first, then everything else by text), so the output is stable between runs.
- String keys are quoted, number keys are not. Values other than tables go through
tostring. - A table that contains itself prints
<cycle>at the repeat instead of looping forever. A table that appears twice without cycling prints in full both times. depthis the starting indent level (default 0), for output nested inside other text.