Add debug function

This commit is contained in:
Daniel Poelzleithner 2022-06-01 21:27:33 +02:00
parent 22259eee49
commit 867a3cec8e

View File

@ -36,6 +36,24 @@ terminate = lsyncd.terminate
now = lsyncd.now
readdir = lsyncd.readdir
--
-- Debug helper. Prints contents of `tbl`, with indentation.
-- `indent` sets the initial level of indentation.
--
function dump(tbl, indent)
if not indent then indent = 0 end
for k, v in pairs(tbl) do
formatting = string.rep(" ", indent) .. k .. ": "
if type(v) == "table" then
print(formatting)
dump(v, indent+1)
elseif type(v) == 'boolean' then
print(formatting .. tostring(v))
else
print(formatting .. v)
end
end
end
local inherit = nil
local inheritKV = nil