I am currently evaluating otto to use as a scripting language for a simple application that executes small scripts on events (the events are button presses on a elgato stream deck).
It works very well so far!
In general the scripts are very short and can be executed one after the other, but I also want to have longer running processes, like starting a countdown. And while these processes runs, it should be possible to press other buttons and start other processes in parallel.
Now I am thinking about how to approach that, and maybe someone with experience with otto would be so kind to give me some advice?
Here are my ideas:
Create a go routine and a otto VM for every button press and execute the buttons script in that VM. Is that a good Idea? I also need some simple mechanism for global variables, but I could add functions (setGlobal, getGlobal) to the VM to have this functionality.
Create a go routine for every button but reuse one otto VM. I tried that, it works. But I guess that is not intended usage and might introduce all sorts of unexpected bugs.
Implement an event loop (like in http://github.com/robertkrimen/natto). This is my favorite option. But since otto does not support await/async syntax, this makes the script harder to write for inexperienced script writers and I want to keep the writing of the scripts as simple as possible.
So I am hoping I am not rude by asking for advice. And thanks for again this great project and all the work that went into it.
All of the options you have listed sound reasonable, but this is really for issues not advice on use, I suggest you use https://stackoverflow.com/ for that.
Thanks for the great project!
I am currently evaluating otto to use as a scripting language for a simple application that executes small scripts on events (the events are button presses on a elgato stream deck).
It works very well so far!
In general the scripts are very short and can be executed one after the other, but I also want to have longer running processes, like starting a countdown. And while these processes runs, it should be possible to press other buttons and start other processes in parallel.
Now I am thinking about how to approach that, and maybe someone with experience with otto would be so kind to give me some advice?
Here are my ideas:
setGlobal
,getGlobal
) to the VM to have this functionality.So I am hoping I am not rude by asking for advice. And thanks for again this great project and all the work that went into it.