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: String Manipulation Help

Previous Thread :: Next Thread 
SayThe is not online. 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
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
14 Sep 2015 04:09 PM
local Words = {}
for Word in string.gmatch(Text, "%S") do
table.insert(Words, Word)
end
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
14 Sep 2015 04:09 PM
for i in str:gmatch'%S+' do end
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
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
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
14 Sep 2015 04:10 PM
@morash that wouldnt catch your name reference
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
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 is not online. SayThe
Joined: 24 Jun 2013
Total Posts: 89
14 Sep 2015 04:17 PM
Thank you guys very much
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
14 Sep 2015 04:18 PM
glad i could help
Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
14 Sep 2015 04:54 PM
phoenix wtf no
Report Abuse
GoogleAnalytics is not online. GoogleAnalytics
Joined: 08 Aug 2008
Total Posts: 455
14 Sep 2015 04:57 PM
-slap with fish-

http://lua-users.org/wiki/StringIndexing


-slaps angles-
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