magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 14 Jun 2013 04:21 PM |
| Is there an easy way to simple kill a coroutine preferably outside of it. |
|
|
| Report Abuse |
|
|
Maradar
|
  |
| Joined: 06 Mar 2012 |
| Total Posts: 4478 |
|
|
| 14 Jun 2013 04:24 PM |
| Break could work? I don't usually use coroutine. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 14 Jun 2013 04:25 PM |
| Outside of the script or ouside of the Coroutine? |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
| |
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 14 Jun 2013 04:46 PM |
The easiest way would be to use more than one script simulating a coroutine, then using the Disabled property to kill it. There's really no way to kill a lua coroutine without going inside of it to kill it.
Unless there's a clever solution hardly anyone knows about. |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2013 04:50 PM |
| Why wouldnt coroutine.yield work? |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 14 Jun 2013 04:52 PM |
| Because that yields the coroutine it is called in. |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 14 Jun 2013 04:55 PM |
| How do I completely remove it, not just yield it? |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 14 Jun 2013 04:56 PM |
| Coroitine:stop(Cornoitine) |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 14 Jun 2013 05:00 PM |
You could just do this... If not, what exactly are you making?
============= Script1:
while true do wait(0.5) print("I'm a fake coroutine! Nothing can kill me!") end
============== Script2:
wait(4.3) workspace.Script1:Destroy() print("Haha!") |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 14 Jun 2013 05:01 PM |
| No because I would need to make thousands of scripts if I did that. I'll find a way. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 14 Jun 2013 05:28 PM |
Sadly you won't... Because there's no way you can stop a coroutine from the outside... That's the same thing as:
function bla() wait(2) end
local connection coroutine.resume(coroutine.create(function() connection = bla() end)
wait(1)
connection:STOP()
^^ This makes no sence, because there's no way you can stop it from the outside!
Maybe we can help you out if you say what you need... Maybe we can help scripting it another way..?
~sycips~ |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 14 Jun 2013 05:28 PM |
| I've managed to do it, it's just a bit more inefficient than what i would have liked. Ah well. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 15 Jun 2013 05:12 AM |
| Can you post your solution? I'd like to see what you managed to do, because I wouldn't have a clue of how to do this... |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
| |
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 15 Jun 2013 05:58 AM |
I was trying to kill them when a value updated so i just put.
script.Parent.Aggressive.Value == true then break end
|
|
|
| Report Abuse |
|
|
|
| 15 Jun 2013 06:54 AM |
break the loop?
coroutine.resume(coroutine.create(function() while wait() do if continue then print("haha nothing can stop me") else break end end end)) |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
| |
|