lua-users home
lua-l archive

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


On Thu, Oct 09, 2008 at 05:59:05PM +0300, ketmar wrote:
> On Thu, 9 Oct 2008 09:53:17 -0500
> "Jeff Wise" <jwise@sealyrealty.com> wrote:
> 
> > I have a Lua function that includes:
> > 
> >   local s = string.find(buffer, ff)
> > 
> > The ff is defined as 0x0C (a form feed), and is a "special
> > character". The find is "finding" form feeds where there are none (as
> > verified with a hex editor). Is there a problem in using this string
> > function for finding special characters? If so, how do I search
> > buffer for a form feed? 
> from manual:
>   string.find (s, pattern [, init [, plain]])
> 
> so you can try buffer:find(ff, 1, true) and see if anything changes.
> this will turn off Lua "pattern matching" and perform a simple
> substring search.
> 

Perhaps your variable "ff" isn't what you think it is..

> =string.byte("a")
97
> str = "a"
> num = 97
> =string.char(num)
a
> =string.find("foobar", str)
5	5
> =string.find("foobar", num)
nil