lua-users home
lua-l archive

Re: string.find

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


On Thu, Oct 9, 2008 at 11:32 AM, Jeff Wise <jwise@sealyrealty.com> wrote:
>>ff = 0x0C or ff = string.char(0x0C) ?
>
> ff is defined as 0x0C, i.e. "local ff = 0x0C".
Don't let your experience in assembly language be a handicap. Reread
the Lua documentation, giving special attention to the value types.
As a start: strings are not bytes, much less numbers. 0x0C isn't a
string, nor a byte, it's a number. If you want strings defined by the
hex ASCII codes, use string.char(n), as shown by Luiz.
Lua's autoconvertion won't do what you want, when you put a number
(like 0x0C == 12.0) where it needs a string, it will create a string
with a readable rendering of the number: "12".
-- 
Javier

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