shonclub
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 1331 |
|
|
| 22 Sep 2013 10:43 AM |
Can someone explain this in a way that noobs(me) can understand? I looked at wiki and it looked like.... I don't even know what to call it... HELP! |
|
|
| Report Abuse |
|
|
Apatheia
|
  |
| Joined: 16 Aug 2013 |
| Total Posts: 198 |
|
|
| 22 Sep 2013 10:47 AM |
It's like match but it returns a iterator function that returns a match of the pattern everytime it's called until there are no more matches.
|
|
|
| Report Abuse |
|
|
Apatheia
|
  |
| Joined: 16 Aug 2013 |
| Total Posts: 198 |
|
|
| 22 Sep 2013 11:03 AM |
Here I recreated it.
function gmatch(str, pattern) local str = str function match(pattern) local result = str:match(pattern) str = str:sub(select(2, str:find(pattern))+1, -1) return result end return match, pattern, str end
for match in gmatch("Hola mundo", "%w+") do print(match) end |
|
|
| Report Abuse |
|
|
shonclub
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 1331 |
|
|
| 22 Sep 2013 11:26 AM |
| uhhh, string.gmatch you mean? :P |
|
|
| Report Abuse |
|
|
jnickib
|
  |
| Joined: 28 May 2012 |
| Total Posts: 137 |
|
|
| 22 Sep 2013 11:27 AM |
Come to my extremely realistic Minecraft game!
p.s. http://wiki.roblox.com/index.php/String.gmatch#string.gmatch_.28s.2C_pattern.29 |
|
|
| Report Abuse |
|
|