80 posts
Location
Magic land, awesomeness
Posted 14 December 2014 - 12:00 AM
Can anyone please explain what the API
coroutine is thanks!
256 posts
Posted 14 December 2014 - 12:04 AM
7083 posts
Location
Tasmania (AU)
Posted 14 December 2014 - 12:37 AM
227 posts
Location
Germany
Posted 14 December 2014 - 12:38 AM
As your question isn't really clear, I would give
this a look.
131 posts
Posted 14 December 2014 - 03:42 AM
You can also check out the Coroutines chapter of Programming in Lua:
http://www.lua.org/pil/9.1.html It explains coroutines pretty well. There's also an explanation section in the Lua Reference Manual:
http://www.lua.org/manual/5.1/manual.html#2.11EDIT: You might also want to check out the Coroutines Tutorial:
http://lua-users.org/wiki/CoroutinesTutorialThe Computercraft Wiki link Bomb Bloke gave is equivalent to this section in the Reference Manual:
http://www.lua.org/manual/5.1/manual.html#5.2Note that the ComputerCraft function os.pullEventRaw is actually coroutine.yield. The ComputerCraft function os.pullEvent is a wrapper function for coroutine.yield that checks for terminate events, instead of letting you handle them yourself.
EDIT: If you're willing to read an academic paper on the subject, you can read the Coroutines in Lua paper here:
http://www.inf.puc-rio.br/~roberto/docs/corosblp.pdf
Edited on 14 December 2014 - 05:32 AM
80 posts
Location
Magic land, awesomeness
Posted 14 December 2014 - 04:04 PM
You can also check out the Coroutines chapter of Programming in Lua:
http://www.lua.org/pil/9.1.html It explains coroutines pretty well. There's also an explanation section in the Lua Reference Manual:
http://www.lua.org/m...anual.html#2.11EDIT: You might also want to check out the Coroutines Tutorial:
http://lua-users.org...outinesTutorialThe Computercraft Wiki link Bomb Bloke gave is equivalent to this section in the Reference Manual:
http://www.lua.org/m...manual.html#5.2Note that the ComputerCraft function os.pullEventRaw is actually coroutine.yield. The ComputerCraft function os.pullEvent is a wrapper function for coroutine.yield that checks for terminate events, instead of letting you handle them yourself.
EDIT: If you're willing to read an academic paper on the subject, you can read the Coroutines in Lua paper here:
http://www.inf.puc-r...cs/corosblp.pdf
Thanks!