1 Commits

Author SHA1 Message Date
f4a963760a Add dumptable helper function 2025-03-27 20:07:59 +01:00

View File

@@ -326,6 +326,26 @@ function strsplit(inputstr, sep)
return t
end
---@param table table
---@param depth number?
function DumpTable(table, depth)
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 .. ":")
DumpTable(v, depth + 1)
else
print(string.rep(" ", depth) .. k .. ": ", v)
end
end
end
-- String to number conversion helper
function num(str)
return tonumber(str) or 0