Files
wow-Heimdall/Modules/DumpTable.lua

29 lines
642 B
Lua

local _, shared = ...
---@cast shared HeimdallShared
if not shared.dumpTable then
---@param table table
---@param msg string?
---@param depth number?
shared.dumpTable = function(table, msg, depth)
if not table then
print(tostring(table))
return
end
if msg then print(msg) end
if depth == nil then depth = 0 end
if depth > 200 then
print("Error: Depth > 200 in dumpTable()")
return
end
for k, v in pairs(table) do
if type(v) == "table" then
print(string.rep(" ", depth) .. k .. ":")
shared.dumpTable(v, nil, depth + 1)
else
print(string.rep(" ", depth) .. k .. ": ", v)
end
end
end
end