| View previous topic :: View next topic |
| Author |
Message |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Tue Nov 08, 2005 4:21 am Post subject: find "." (dot) in string |
|
|
| 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 |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Tue Nov 08, 2005 4:55 am Post subject: Re: find "." (dot) in string |
|
|
| 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 |
|
 |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Tue Nov 08, 2005 8:08 pm Post subject: |
|
|
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 |
|
 |
Durante
Joined: 02 Oct 2005 Posts: 65 Location: Austria
|
Posted: Wed Nov 09, 2005 1:54 am Post subject: |
|
|
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 |
|
 |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Wed Nov 09, 2005 7:31 am Post subject: |
|
|
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 |
|
 |
|