What will be the equivalent code in lua to calculate checksum written in C
tempString = rx$;
checksum = 255;
for (i = 1 to len(tempString))
{
checksum = checksum ^ byte(tempString, i);
}
tx$ = tempString + chr(checksum);
clearbuffer (rx$);
I tried to changed in lua and build with notepad++. Its working in notepad++ but not in Composer pro. I believe ~ is no longer supported for xor operation.
function check()
local tempString = "ECSA1*1"
local checksum = 255
local tx
for i = 1 , string.len(tempString) do
checksum = checksum ~ string.byte(tempString, i)
end
tx=string.format("Checksum = %s%x",tempString,checksum)
end