diff options
| author | Autumn <git@autumnfo.rest> | 2026-05-17 17:22:58 +0100 |
|---|---|---|
| committer | Autumn <git@autumnfo.rest> | 2026-05-17 17:22:58 +0100 |
| commit | e7563787be5b3a9c1de66a7f4eb16ed09d9d4a21 (patch) | |
| tree | 2956aed96a4d1873ac997bc17ad224815ba4bbb5 /src/utils.lua | |
| parent | 2bad2793f33c3c0879d3a8a36de327a6626c32ed (diff) | |
[main] added ability to fetch service & tidied up functions
Diffstat (limited to 'src/utils.lua')
| -rw-r--r-- | src/utils.lua | 24 |
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 |
