How do I convert string of hex digits to value it represents in Lua

You use tonumber:

local someHexString = "03FFACB"
local someNumber = tonumber(someHexString, 16)

Note that numbers are not in hexadecimal. Nor are they in decimal, octal, or anything else. They're just numbers. The number 0xFF is the same number as 255. "FF" and "255" are string representations of the same number.

Share:
Admin
Author by

Admin

Updated on March 22, 2020

Comments

  • Admin
    Admin over 2 years

Related