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: What is coroutine.wrap() used for???

Previous Thread :: Next Thread 
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
04 Oct 2011 07:53 PM
[ Content Deleted ]
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
04 Oct 2011 08:00 PM
It's basically a fast way of saying

coroutine.resume(coroutine.create(function() end))

Plus, it can be used to catch errors without stopping the entire script.

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and breaker of combos::]-
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
04 Oct 2011 08:00 PM
[ Content Deleted ]
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
04 Oct 2011 08:01 PM
You still can, I think. Idk, I don't know how to use coroutine.yield :P

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and breaker of combos::]-
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
04 Oct 2011 08:03 PM
Coroutine.wrap returns a function which, when called, runs its code in a separate thread.


local myFunc = coroutine.wrap(function()
while wait(0.5) do
print'Hello, world!'
end
end)

myFunc()


print 'Not in the loop!'
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
04 Oct 2011 08:04 PM
Whoa, did NOT know that.

I wish I was smart :<

-[::ƧѡÎḾḠΰῩ::]-
-[::Maker of stuff and breaker of combos::]-
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
04 Oct 2011 08:09 PM
clones :O
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
04 Oct 2011 09:03 PM
Should be something like:

function coroutine.wrap( func )
local cr = coroutine.create(func)
return function(...) return coroutine.resume(cr,...) end
end
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