Open hellocatfood opened 2 years ago
Yes this is something that I tried to do at some point (there is still a Lua and JS branch somewhere on GitHub). It would indeed be very nice, not just for exporters, but even maybe to implement new tools.
From my little tests I think the easiest would be to do it in js, and make all the core objects (layers, camera, etc) internally support being wrapped into js objects.
Look into https://github.com/svaarala/duktape, it's pretty good and small too, tho lua was more "easy" which i implemented but will add duktape in near future too.
There is already a 'ducktape' branch in GitHub that I did a long time ago to add scripting support. One issue was that it was too slow in my opinion. Goxel also used to have Lua scripting support a while ago. Since I didn't see much use for it I removed it, as I don't want to bloat the program with things that nobody uses. I think I also had a look at quickjs, though the code is not online.
Interesting, re-implement lua again then, it's simple and "fast"
I for one would like to see a Lua scripting API. Then I could use Fennel!
I am wondering what would the be pro and con of lua vs javascript as a plugin language. I feel like javascript is generally a better language, but lua is used a lot in video games.
lua is easy to implement, easy to learn even aseprite (a very famous pixel art editor) uses lua for plugin system, lite-xl is a text editor completely made in lua with some awesome plugins for it written in lua.
I started to work on javascript plugin support. In the last release (0.12.0) it is now possible to do some very basic scripts for goxel. I plan to add more bindings. I tried a bit to make it work with lua but in the end I found javascript easier to work with, since I am really not familiar with lua.
Please add support for people to write their own plugins for Goxel.
The benefit of this is that will allow people to write their own model format exporters e.g. #235