blob: 5bcbc8c7c74940dd1328eefb5247152639864b20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
--
-- ~~~ helper utils
--
-- string -> hex
function string.tohex(str)
return (str:gsub(".", function (c)
return string.format("%02X", string.byte(c))
end))
end
-- hex -> string
function string.fromhex(str)
return (str:gsub("..", function (cc)
return string.char(tonumber(cc, 16))
end))
end
-- get information from the pawsd response
function extractfromresponse(response, start, last)
local result = {}
table.move(response, start, last, 1, result)
result = string.tohex(table.concat(result))
return result
end
|