This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
__Kiwi's profile picture

How to use coroutines for a game?

Started by __Kiwi, 04 May 2015 - 03:14 PM
__Kiwi #1
Posted 04 May 2015 - 05:14 PM
Hello!

I'm working on my game. It have to render every 0.2 seconds and pull event as much as it can. How can I do this with Lua? I've read the tutorial on the lua.org and lua-users.org page but I cant't understand. :(/>

Can someone tell me how should I implement this?

(Sorry for my bad english.)
Lyqyd #2
Posted 04 May 2015 - 05:35 PM
You don't need to use coroutines for this. Use one event handling loop to deal with user input and timer events to time your rendering. Check out the worm game that comes with ComputerCraft for an example.
__Kiwi #3
Posted 04 May 2015 - 06:29 PM
You don't need to use coroutines for this. Use one event handling loop to deal with user input and timer events to time your rendering. Check out the worm game that comes with ComputerCraft for an example.

Thank you for the fast reply. :D/>