3 ms·
I used to have a program with an embedded Lua interpreter where I sometimes needed to switch back and forth between C++ and Lua. It's insane. Arrays don't start
by emsy 11y ago
I used to have a program with an embedded Lua interpreter where I sometimes needed to switch back and forth between C++ and Lua. It's insane. Arrays don't start at zero, you create blocks with keywords and then there are some minor annoyances like != being ~= or the lack of a ternary operator. Where Lua really shines though is the binding api. It's really easy to use when you have to do something by hand. The documentation is great and you have a selection of binding tools. You can even create classes with overridable virtual methods.
Since Lua is rather tedious to use for me, I looked for alternatives with a C-like syntax. I found Squirrel and Wren but the last time I looked they lacked the tooling and mailing lists that Lua already has. It's a bit of a chicken-egg problem unfortunately.
- eropple 11y agoAn option that might be worth looking at is AngelScript, which I think minimizes the context switch between C++ and the scripting layer really nicely.
- emsy 11y agoI totally forgot about AngelScript. It really has the lowest context switching overhead, but you get to keep the verbose C++ syntax in return, which is a trade-off. Personally I don't mind if a language differs somewhat, but with Lua I constantly get errors because of basic things like braces, comments and comparisons.
- Pxtl 11y agoI wonder of a language-agnostic computing platform could be developed based on a Lua-like securely-embedded system. That is, something like the JVM, but the client code can only access the things that are explicitly provided to it by the host environment. You'd be pretty constrained by what concepts of "object" to support, though.
- pygy_ 11y agoFor Thimbleweed Park, Ron Gilbert considered Lua but found it too "goofy" syntactically, and ended up using Squirrel. https://blog.thimbleweedpark.com/engine https://blog.thimbleweedpark.com/engine
- emsy 11y agoAnother thing I forgot to mention was tooling. With Lua you can already get debuggers, libraries and IDEs that other languages still lack.
- munificent 11y ago> I found Squirrel and Wren but the last time I looked they lacked the tooling and mailing lists that Lua already has. Yup, Wren still has a long ways to go in terms of being a mature ecosystem, but it's getting there slowly. It would be moving faster, honestly, if I put more time into it, but there are only so many hours in the day.