[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Hex constant definitions
- From: Matthew Paul Del Buono <delbu9c1@...>
- Date: Mon, 22 Sep 2008 12:42:23 -0400 (EDT)
>Maybe I should restate my question:
>
>How do I define a 3 byte hex constant of 'D3A8AF', or more generally, of any
>length using the normal hex characters of 0-F?
>
The correct answer to do this would be something along the lines of:
local foo = 0xD3A8AF;
Which you had originally.
If you have some string that you need to parse into this, you can also do it in this manner:
local str = "D3A8AF";
local bar = tonumber(str, 16); -- 16 == base
assert(bar == foo);
Regards,
-- Matthew P. Del Buono