lua-users home
lua-l archive

Re: Converting dec to hex issues

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


Quoth Marcin Jurczuk <mjurczuk@gmail.com>, on 2010年11月18日 18:44:54 +0100:
> > print("Original value: " .. os.time() .. " Decimal base conversion: " .. tonumber(os.time(),10) .. " Hex version: " .. tonumber(os.time(),16))
That's backwards. You're saying "convert this result, first converted
implicitly into a string, into a number as though the digits were base
16", so you're asking for the numeric value of 0x1290102177.
You probably want string.format('%x', os.time()).
 ---> Drake Wilson

AltStyle によって変換されたページ (->オリジナル) /