aboutsummaryrefslogtreecommitdiff
path: root/src/utils.lua
diff options
context:
space:
mode:
authorAutumn <git@autumnfo.rest>2026-05-17 17:22:58 +0100
committerAutumn <git@autumnfo.rest>2026-05-17 17:22:58 +0100
commite7563787be5b3a9c1de66a7f4eb16ed09d9d4a21 (patch)
tree2956aed96a4d1873ac997bc17ad224815ba4bbb5 /src/utils.lua
parent2bad2793f33c3c0879d3a8a36de327a6626c32ed (diff)
[main] added ability to fetch service & tidied up functions
Diffstat (limited to 'src/utils.lua')
-rw-r--r--src/utils.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/utils.lua b/src/utils.lua
index 83e1d46..5851e1c 100644
--- a/src/utils.lua
+++ b/src/utils.lua
@@ -27,3 +27,27 @@ function table.extracthex(response, start, last)
return result
end
+
+-- table -> pretty print
+function table.dump(response)
+
+ if type(response) == "table" then
+
+ local start = "{ "
+
+ for key, value in pairs(response) do
+
+ if type(key) ~= "number" then key = '"' .. key .. '"' end
+
+ start = start .. "[" .. key .. "] = " .. table.dump(value) .. ","
+
+ end
+
+ return start .. "} "
+
+ else
+
+ return tostring(response)
+
+ end
+end