|
| 26 Sep 2015 11:05 AM |
I have a string with a few names separated by commas:
"Person1, Person2, Person3"
How do i turn this string into a table?
for example, there's a string.split method in javascript. is there something like that here?
thanks in advancee! |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Sep 2015 11:07 AM |
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation#string.gmatch
I'm not good with string operations like that but um... that can get you started.
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2015 11:07 AM |
table.concat turns a table into a string.
thanks for trying anyway! |
|
|
| Report Abuse |
|
|
Stymi
|
  |
| Joined: 19 Sep 2015 |
| Total Posts: 1077 |
|
| |
|
| |
|
|
| 26 Sep 2015 11:10 AM |
THANK YOU!
but what pattern do i use to capture commas? |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2015 11:14 AM |
| string.gmatch(String,",*") |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 26 Sep 2015 11:14 AM |
for thing in string.gmatch("person1,person2,person3","%a+") do print(thing) end
Red Blossoms |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 26 Sep 2015 11:15 AM |
oh oopsies for thing in string.gmatch("person1,person2,person3","%w+") do print(thing) end
Red Blossoms |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2015 11:15 AM |
So I give you the link to the wiki page, and then you bump, and then Stmyi says the same thing but without the link and you thank him? ok then. xD
I'll try to figure it out, but for now here's what I'm reading. http://lua-users.org/wiki/PatternsTutorial
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2015 11:24 AM |
| Sorry! THANKS EVERYONE FOR THE HELP! |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 26 Sep 2015 11:39 AM |
@fishguy xD xD xD
You thought it was table.concat() |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2015 11:40 AM |
| More like I read it wrong. |
|
|
| Report Abuse |
|
|