|
| 01 Aug 2016 09:46 PM |
Say I have this:
while true do wait(1) print "lel" end
while true do wait(1) print "rekt" end
Will both loops run or will only the top one work? Sorry im super dumb |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 01 Aug 2016 09:48 PM |
| Well it will never get past the first loop since you never break out of it. |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2016 09:48 PM |
Only one because it's the same thread and it'll execute top to bottom. Which in this case gets caught up in the first loop.
You can use coroutines like so:
c = coroutine.create(function(...) while wait(1) do print "lel" end end)
c.resume()
while wait(1) do print "rekt" end
Then both will run at about the same time |
|
|
| Report Abuse |
|
|