mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-11 18:38:48 +00:00
Add debug function
This commit is contained in:
parent
22259eee49
commit
867a3cec8e
18
lsyncd.lua
18
lsyncd.lua
@ -36,6 +36,24 @@ terminate = lsyncd.terminate
|
|||||||
now = lsyncd.now
|
now = lsyncd.now
|
||||||
readdir = lsyncd.readdir
|
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 inherit = nil
|
||||||
local inheritKV = nil
|
local inheritKV = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user