forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

find "." (dot) in string

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
the underminer



Joined: 03 Oct 2005
Posts: 124
Location: Netherlands

PostPosted: Tue Nov 08, 2005 4:21 am    Post subject: find "." (dot) in string Reply with quote

Code:
dot = string.find (contents[1], [[.]])

doesn't work. Neither does
Code:
dot = string.find (contents[1], ".")

Does anyone know why this happens or how to do this?
_________________
Behold! The Underminer got hold of a PSP
Back to top
View user's profile Send private message
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Tue Nov 08, 2005 4:55 am    Post subject: Re: find "." (dot) in string Reply with quote

the underminer wrote:
Code:
dot = string.find (contents[1], [[.]])

doesn't work. Neither does
Code:
dot = string.find (contents[1], ".")

Does anyone know why this happens or how to do this?


dot = string.find (contents, ".") ?
Back to top
View user's profile Send private message
the underminer



Joined: 03 Oct 2005
Posts: 124
Location: Netherlands

PostPosted: Tue Nov 08, 2005 8:08 pm    Post subject: Reply with quote

no, contents[i] is right. I'm trying to find "." in the array contents where i is the entry number. i = 1 So it reads from the first entry of contents. I'm not wrong there
_________________
Behold! The Underminer got hold of a PSP
Back to top
View user's profile Send private message
Durante



Joined: 02 Oct 2005
Posts: 65
Location: Austria

PostPosted: Wed Nov 09, 2005 1:54 am    Post subject: Reply with quote

Easy, by default find does pattern matching, so . matches any character.
Read more: http://www.lua.org/pil/20.1.html

(I don't know how many threads I have answered with links to PIL already... just read it! - I didn't know Lua 3 weeks ago either ;))

Btw, what you want is "%."
Back to top
View user's profile Send private message
the underminer



Joined: 03 Oct 2005
Posts: 124
Location: Netherlands

PostPosted: Wed Nov 09, 2005 7:31 am    Post subject: Reply with quote

I knew it was a stupid question, but didn't know where to get the answer. thanks a million durante!
_________________
Behold! The Underminer got hold of a PSP
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group