lua-users home
lua-l archive

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


>i=18
>=string.format('0x%x', i)
0x12

 
2007/3/23, Leo M. Cabrera <leo28c@gmail.com>:
Sam Roberts wrote:
> On Thu, Mar 22, 2007 at 08:29:00PM -0400, L-28C wrote:
>
>> PS: The hex number is in string (character) format. Sorry about that.
>>
>
> string.sub() to get rid of the leading "0x"?
>
No; I meant the character itself, not the '0x13' string representation.
The 13th ASCII character, device control 3. It's printing that instead
of the number '13'.

Get what I'm saying? Thanks.
>
>>> I got a question. Given a hexadecimal number (ie. 0x13), how can I
>>> convert that to the string "13"? I use print() and it gives me a random
>>> ASCII character.
>>>
>
>