delduca
7 months ago
When I decided to create a game engine where the game could be entirely scripted in a scripting language, I was choosing between JavaScript (QuickJS), Python (Boost.Python), and Lua (Sol2).
The ease of embedding Lua, even with a C++ wrapper, is incredible. With little effort, I now have something I consider “ready”.
Not to mention, it’s a very lightweight VM.
3036e4
7 months ago
A nice thing about seeing an engine or application support Lua for scripting is that it implies Fennel can be used (and transpiled to Lua). Or at least that is highly likely unless something unusually weird is going on.
triknomeister
7 months ago
Boost.python is not the best scripting tool to be honest. So, that might affect your judgement as well.
UncleEntity
7 months ago
I've yet to find an even decent python binding generator, TBH.
Generally, I use pybindgen to get the basic module and then hack on that by hand. The main problem is most C(++) libraries aren't designed to interoperate with managed memory languages so most of the work is figuring that out. Don't get me wrong, I've tried to work within the binding library (with pybindgen at least) but the amount of work for anything even slightly complicated isn't really worth it.
For a project with a major python API (like blender) you're better off crafting your own python class generator (again, like blended does, and even that has some major issues around object lifetime management). Best would be to design the underlying library/application with python integration in mind but that's not always possible if you want to include other libraries.
I can say I did mess around with using lua as an embedded scripting language within an application years ago and it wasn't too difficult from what I remember. It was only ever a proof-of-concept and didn't go too far so I never ran into the inevitable edge case as one always does with these sorts of things.
miguel_martin
7 months ago
See pybind11 or nanobind
triknomeister
7 months ago
That's very true actually. Boost.Python is not good, but the alternative then is actually doing everything ourselves which seems worse in short term.
conaclos
7 months ago
Is Sol2 a Lua VM or just a wrapper to the standard Lua VM?
delduca
7 months ago
It is a wrapper, in next months it will be also a luau wrapper