generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do I turn a string into a table?

Previous Thread :: Next Thread 
SeashellsAndSand is not online. SeashellsAndSand
Joined: 02 Oct 2012
Total Posts: 140
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
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 11:05 AM
table.concat I think
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
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
SeashellsAndSand is not online. SeashellsAndSand
Joined: 02 Oct 2012
Total Posts: 140
26 Sep 2015 11:07 AM
table.concat turns a table into a string.

thanks for trying anyway!
Report Abuse
Stymi is not online. Stymi
Joined: 19 Sep 2015
Total Posts: 1077
26 Sep 2015 11:09 AM
Yeah it's string.gmatch()
Report Abuse
SeashellsAndSand is not online. SeashellsAndSand
Joined: 02 Oct 2012
Total Posts: 140
26 Sep 2015 11:09 AM
BuMp
Report Abuse
SeashellsAndSand is not online. SeashellsAndSand
Joined: 02 Oct 2012
Total Posts: 140
26 Sep 2015 11:10 AM
THANK YOU!

but what pattern do i use to capture commas?
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 11:14 AM
string.gmatch(String,",*")
Report Abuse
rayk999 is not online. 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 is not online. 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
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
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
SeashellsAndSand is not online. SeashellsAndSand
Joined: 02 Oct 2012
Total Posts: 140
26 Sep 2015 11:24 AM
Sorry! THANKS EVERYONE FOR THE HELP!
Report Abuse
yobo89 is not online. 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
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 11:40 AM
More like I read it wrong.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image