Hi,
I’m trying to port a game I developed for iOS with Apple framework to Corona and Lua in order to have better performance and to be able to release it on Android too.
In my game I have a method called before every frame update where I do all the calculations I need at real time like updating the player position, etc. I now I can do the same in Corona with Runtime:addEventListener(“enterFrame”, myMethod).
There are other tasks I need to perform in an asynchronous way, for example I need to make some calculations for adding tracks to the road the player is running on. I divided these calculations in smaller methods but some of them are still too slow and just can’t complete between two frames so I start them on background threads (dispatch_async) knowing I will have them finished when I will need the results.
How can I do something like that in Corona? I can’t find I way to start a job in a background thread up to now.
I looked at coroutines but I can’t find a way to use them for executing a background job since they just stop the main thread until they yield the control back to it.
Thank you