I’ve made a bit of progress binding the Nextbot stuff.. despite not talking about it.
When I was designing how it should interface with Lua I started off mimicing how it worked in the engine. After a few good sleeps I decided that it wasn’t the way to go. It’s coded like that in the engine because of the limitations of C++. We don’t have these limitations in Lua – so lets try to use that to our advantage.
So I decided to use coroutines. First of all let me get this out of the way. Coroutines aren’t threads. They don’t really offer any speed benefits. A more accurate way to imagine them is as a function that you can pause and resume at any time. So imagine you’re writing a script that prints text.. you could do something like this.
So where before you would use timers or whatever…
View original post 124 more words