Posted 11 May 2013 - 11:22 AM
I've been trying to learn how coroutine work, but with not much success. Below is my testing code, what have I done wrong?
function one()
while true do
print("one")
sleep(1)
print("two")
sleep(1)
end
end
function two()
while true do
print("three")
sleep(1)
print("four")
sleep(1)
end
end
o = coroutine.create(one)
co = coroutine.create(two)
while true do
coroutine.resume(o)
coroutine.resume(co)
end
--print(coroutine.status(co))
print("\nThe end.")