diff --git a/lsyncd.lua b/lsyncd.lua index 95cc8a9..c97c2a7 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -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