2 ms·
Hi Leafo I have tried to get in touch a couple of times. Question: Does Moonscript have coroutines ? In case it doesnt, is there a way to use Lua's coroutines t
by srean 13y ago
Hi Leafo I have tried to get in touch a couple of times. Question: Does Moonscript have coroutines ? In case it doesnt, is there a way to use Lua's coroutines together with Moonscript ? In case it does, could you point me to the syntax, couldnt find it in the docs.
- anonymoushn 13y agoYes, it does.
- anonymoushn 13y agoSorry, I can no longer edit my comment above. You just use Lua coroutines. For people unfamiliar with Lua coroutines, there is no extra syntax for them. There are functions coroutine.create, coroutine.resume, and coroutine.yield. They do about what you'd expect them to do. If you're familiar with greenlet, the first function is greenlet() and the second two functions do the job of greenlet.switch(). Here is some Moonscript Leafo wrote using coroutines: https://gist.github.com/leafo/6788652 https://gist.github.com/leafo/6788652
- srean 13y agoAwesome, cant thank enough.