SayThe
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 89 |
|
|
| 14 Sep 2015 04:07 PM |
How would i turn a string into an array.
Example: "Hello SayThe 123" -> {Hello, SayThe, 123}
I was using the gmatch function, but It wouldn't catch any number because it wasn't a string. Maybe the pattern I was using wasn't correct, but if anyone can help. Thankyou. |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 04:09 PM |
local Words = {} for Word in string.gmatch(Text, "%S") do table.insert(Words, Word) end |
|
|
| Report Abuse |
|
|
lostend
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 8265 |
|
|
| 14 Sep 2015 04:09 PM |
| for i in str:gmatch'%S+' do end |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 04:09 PM |
local tab = {} local str = "Hello SayThe 123"
for i = str:gmatch("%w+") do table.insert(tab,i) end |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 04:10 PM |
| @morash that wouldnt catch your name reference |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 04:10 PM |
_tab = {} for _match in string.gmatch("Hello SayThe 123",'.[%s]') do table.insert(_tab,_match) end for _,v in pairs(_tab) do print(v) end |
|
|
| Report Abuse |
|
|
SayThe
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 89 |
|
| |
|
| |
|
| |
|
|
| 14 Sep 2015 04:57 PM |
-slap with fish-
http://lua-users.org/wiki/StringIndexing
-slaps angles- |
|
|
| Report Abuse |
|
|