Files
barotrauma-localmods/CykaQuick/Lua/Cyka/dump.lua
2025-03-31 13:14:09 +02:00

25 lines
510 B
Lua

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