News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
string.find bug
Author Message
asafp
Member
***


Posts: 81
Group: Registered
Joined: Jan 2008
Status: Offline
Reputation: 0
Post: #1
string.find bug

I have something like this in a loop

i=string.find(string,lookfor,icur,true)

In some cases, it seems that i is being set to 1 when a match is found at the end of the string, which caused my program to go into a loop. I fixed it by testing for i==nil or i<icur so that the test for not found would include i being set to 1 in addition to nil.

It's a complex program and I haven't been able to create a simple program that reproduces the situation.

Has anyone else ever encountered anything like this? Am I crazy? i should never get set to anything less than the starting position which is icur, right?

03-01-2008 11:53 AM
Visit this user's website Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #2
RE: string.find bug

Quote:
i should never get set to anything less than the starting position which is icur, right?

That's true, as far as I can tell. I suppose it would depend on what the actual string and variable values are, though. We can speculate all we want, but unless you provide more specific info than i=string.find(string,lookfor,icur,true) all it's going to be is speculation.

03-01-2008 01:37 PM
Find all posts by this user Quote this message in a reply
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #3
RE: string.find bug

Yep, need to see the string its failing on.
I'm not getting any bug type result here.

A return of nil seems to occur where appropriate.

Whats your hardware and os?

This post was last modified: 03-02-2008 01:53 AM by iGame3D.

03-02-2008 01:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: