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 » Scripting Helpers
Home Search
 

Re: gsub Help Pl0x

Previous Thread :: Next Thread 
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
15 Dec 2011 08:48 PM
I've been learning Lua for 2+ years, but I still have no clue what gsub does... can anyone sum it down for me so it's easier to understand?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Dec 2011 08:51 PM
string.gsub(STRING, PATTERN, REPLACEMENT, MAX)

Goes through STRING looking for any PATTERN and replacing PATTERN with REPLACEMENT.


You can also specify an amount of matches to find by supplying integer MAX.
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
15 Dec 2011 08:52 PM
string.gsub(YourString, A, B)

All arguments are strings. A copy of the string will be returned, except every time A occurs in the copy, it is replaced by "B"

print(string.gsub("Hello world!", "Hello", "Goodbye"))

>Goodbye world!
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
15 Dec 2011 08:52 PM
Oh... thanks guys! :D:D:D:D:D:D
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Dec 2011 09:14 PM
"A copy of the string will be returned"

It also returns the number of matches found.
I forgot to mention it returns a copy and number of matches myself... >_<
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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