I\'m using a front-end of Lua which is unfortunately outdated, so I\'m stuck with version 5.1 here, meaning the bit32
library is out of reach (which I probably
The float2hex in the example above returns an int. That being said if anyone needs it here is a intToHex conversion function that can be found in the lua archives (http://lua-users.org/lists/lua-l/2004-09/msg00054.html). I used the return value of the float2hex function above and fed it into this function. The output of intToHex is a string (Ex: 0xA4CD).
function intToHex(IN)
local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
while IN>0 do
I=I+1
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
OUT = "0x" .. OUT
return OUT
end