diff options
| author | Autumn <git@autumnfo.rest> | 2026-05-17 11:01:33 +0100 |
|---|---|---|
| committer | Autumn <git@autumnfo.rest> | 2026-05-17 11:01:33 +0100 |
| commit | d6f22794fc2d42fc2573c023d6814ececdd03c1d (patch) | |
| tree | 3283d6c0d63596dac93f45a0648afd72f05ee9db | |
| parent | 1d34c2e5e144728c16807bb53b8eda278a350b4d (diff) | |
[pawsd] added record fetching utils
| -rw-r--r-- | src/pawsd/record.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/pawsd/record.lua b/src/pawsd/record.lua new file mode 100644 index 0000000..ae6d145 --- /dev/null +++ b/src/pawsd/record.lua @@ -0,0 +1,49 @@ +-- +-- ~~~ response record utils +-- + +require("src/utils") + +-- setup pawsd +local pawsd = {} +pawsd.tag = require("src/pawsd/tag") + +-- get number of tags +function getrecordtagnumber(response, offset) + + return tonumber(table.extracthex(response, offset, offset + 1), 16) + +end + +-- get all record information +function getrecord(response, offset) + + local tagcount = getrecordtagnumber(response, offset) + + print("R>------ Number Of Tags: " .. tagcount) + + local tagoffset = offset + 2 + local tags = {} + + for tagindex = 1, tagcount, 1 do + + print("\nT>------ Getting Tag " .. tagindex .. "...") + + local tag = pawsd.tag.get(response, tagoffset) + + tags[tagindex] = tag.value + tagoffset = tag.endoffset + + end + + return { + tags = tags, + endoffset = tagoffset + } + +end + +-- return +return { + get = getrecord +} |
