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 wait()

Previous Thread :: Next Thread 
kirkyturky12 is not online. kirkyturky12
Joined: 30 Apr 2010
Total Posts: 1915
27 Jan 2012 10:32 PM
What is the pattern to remove all wait()'s using gsub? I try this:

scripters = "wait() print'Hi'"
scripters = string.gsub(scripters,"wait()","")

print(scripters)

I get "() print'Hi'". Any help?
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
27 Jan 2012 10:34 PM
Why don't you just learn more about coroutines like I said... It is so much easier to make a constantly updating coroutine then just completely remove the wait function from your script builder...

⦅TNS⦆
Report Abuse
kirkyturky12 is not online. kirkyturky12
Joined: 30 Apr 2010
Total Posts: 1915
27 Jan 2012 10:36 PM
:( I don't get coroutines, though. I've read a lot of stuff, I just understand them. My mind is too small to comprehend...
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
27 Jan 2012 10:36 PM
and i think you would need to use string.find to search for 'wait' and then sub it at that point and search for ')' then cut of where wait starts and where ) ends :P
Report Abuse
TheImpersonator is not online. TheImpersonator
Joined: 19 Jul 2011
Total Posts: 111
27 Jan 2012 10:56 PM
scripters = "wait() print'Hi'"
scripters = string.gsub(scripters,"wait%p%p%s*","")
print(scripters)

>print'Hi'
Report Abuse
TheImpersonator is not online. TheImpersonator
Joined: 19 Jul 2011
Total Posts: 111
27 Jan 2012 10:57 PM
You can actually take out the '%s*' it just removes the extra whitespace after 'wait()"
Report Abuse
rcm is not online. rcm
Joined: 29 Jul 2008
Total Posts: 621
27 Jan 2012 11:35 PM
The problem is that the parenthesis () are used for pattern captures:
http://wiki.roblox.com/index.php/Patterns#Captures

To get around it, put a % infront of each parenthesis (% acts as an escape character). Ex:

scripters = "wait() print'Hi'"
scripters = string.gsub(scripters,"wait%(%)","")
print(scripters)
Report Abuse
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
28 Jan 2012 03:46 AM
Above, Agree.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
28 Jan 2012 04:04 AM
str = "wait()Hello! wait()This iwait()s wait()await() strwait()ing."
str = str:gsub("wait%(%)", "")
str = str:gsub("Wait%(%)", "")
print(str)

It also works if wait uses a capitalized first letter, as that can be done too.
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