lua-users home
lua-l archive

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



Am 02.06.2013 08:35 schrieb <meino.cramer@gmx.de>:
>
> Hi,
>
> I have to convert *a lot* of decimal numbers, given textually in a
> ASCII file into hexadecimal.
>
> The conversion itself is not the problem ("io.write(string.format(
> "%X",....))").
>
> But the hexadecimal number have to have leading zeroes...
>
> The format "%X" seems not to support leading zeroes as in C....
>
> How can I accomplish this with not too much overhead with lua 5.1x ?
>
> Thank you very much in advance for any help!
> Best regards,
> mcc
>
>
>

string.format("0x%x", 245)