Lowcart
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
|
| 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
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|