31 lines
665 B
Lua
31 lines
665 B
Lua
local _, shared = ...
|
|
---@cast shared HeimdallShared
|
|
|
|
if not shared.dump then
|
|
---@param value any
|
|
---@param depth number?
|
|
shared.dump = function(value, depth)
|
|
if not value then
|
|
print(tostring(value))
|
|
return
|
|
end
|
|
if type(value) ~= "table" then
|
|
print(tostring(value))
|
|
return
|
|
end
|
|
if depth == nil then depth = 0 end
|
|
if depth > 200 then
|
|
print("Error: Depth > 200 in dump()")
|
|
return
|
|
end
|
|
for k, v in pairs(value) do
|
|
if type(v) == "table" then
|
|
print(string.rep(" ", depth) .. tostring(k) .. ":")
|
|
shared.dump(v, depth + 1)
|
|
else
|
|
print(string.rep(" ", depth) .. tostring(k) .. ": " .. tostring(v))
|
|
end
|
|
end
|
|
end
|
|
end
|