lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I hit a bit of a problem.
According to docs tonumber() can convert strings to digits with optional "base"
I'm trying to convert current time to hex format and it seems doesn't
work (at least with huge numbers)

> print("Original value: " .. os.time() .. " Decimal base conversion: " .. tonumber(os.time(),10) .. " Hex version: " .. tonumber(os.time(),16))
Original value: 1290102177 Decimal base conversion: 1290102177 Hex
version: 4294967295

Hex value is always "4294967295" even when time this some
limit ?? (4294967295 is 2^32) ...

Is there some simple way to convert DEC -> HEX ??

Thanks in advance.