From d6f22794fc2d42fc2573c023d6814ececdd03c1d Mon Sep 17 00:00:00 2001 From: Autumn Date: Sun, 17 May 2026 11:01:33 +0100 Subject: [pawsd] added record fetching utils --- src/pawsd/record.lua | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/pawsd/record.lua (limited to 'src') 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 +} -- cgit v1.3