30.06.2021, 12:48
The most correct way to do this is via bit shifts (bit.rshift and bit.band) but since you need to split the value into 4 bit values you can simply use the datahex string:
Code:
value = event.datahex
values = {}
for i = 1, 4 do
char = value:sub(i, i)
values[ i ] = tonumber(char, 16)
end
log(values)