[LuaVIEW-users] Hexadecimal constants

Albert-Jan Brouwer ajbrouwer at gmail.com
Wed Aug 13 19:45:28 GMT+2 2008


Dave,

LuaVIEW is based on Lua 5.0 as you can check by
printing the _VERSION global or the string returned by
lv.luaversion(). Unlike Lua 5.1, Lua 5.0 does not handle
hex numbers in the parser.

However, you can obtain a number from a hexadecimal
string using the tonumber() function, e.g.:
print(tonumber("1A",16)) -> 26

To make it a little less ugly, you can define a helper
function like so:
function X(str) return tonumber(str, 16) end
print(X"DEADBEEF") -> 3735928559



More information about the LuaVIEW-users mailing list