15.03.2021, 22:17
(15.03.2021, 14:21)baggins Wrote: Thanks admin.
Now, I am developping this script not on LM but on a 'normal' Linux box, because I don't want to use the LM that is in production... Is there some standard lua equivalent for lmcore.hextostring?
Also the perl script converts the command to a readable string for logging purposes:
Code:$commandhex =~ s/(.)/sprintf("0x%x ",ord($1))/eg;
How would that be done in lua?
Thanks!
I've found a script and written another one that I can use on my Linux box.
Code:
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function printhex (str)
length = string.len(str)
result = ""
for i = 1, length,2 do
result = result..'0x'..string.sub(str,i,i+1).." "
end
return result
end