Re:Using Lua coroutines to create an RPG dialogue system
by anonymoushn on Wednesday January 11, 2017 @06:02PM
(#13378269)
This is an interesting characterization of the situation! I can save the 20 LOC involved in implementing this if I just give up the ability to write my own event loops and pepper my code with a bunch of additional "await"s every time I add an asynchronous operation to a function used by other functions.
Re:Using Lua coroutines to create an RPG dialogue system
by unscaled on Thursday January 12, 2017 @04:31AM
(#13380985)
You can also implement your own event loops with promises, but it's a matter of tradeoffs again:
You can't control the way functions written by someone else will schedule their internal continuations - you can only control the way you schedule your own continuation. I'm not sure if Javascript gives you a lot of control there, but C# allows you to define your own TaskScheduler and specify it on ContinueWith.
JavaScript promises do (Promise.all).