-
The idea was to be able to convert any existing Lua code automatically and get it working as before like I did with some non trivial projects like:
- https://github.com/mingodad/CorsixTH-ljs
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
-
extism
The framework for building with WebAssembly (wasm). Easily load wasm modules, move data, call functions, and build extensible apps.
The WebAssembly component model is aimed at having composable components that can call each other. The components can be written in any language, compiled to WebAssembly, and interoperate: https://github.com/WebAssembly/component-model/
Extism is a plugin framework for WebAssembly:
https://extism.org/
https://github.com/extism/extism
Visual Studio Code can run WebAssembly extensions: https://code.visualstudio.com/blogs/2024/05/08/wasm
A project to bring WebAssembly plugins to Godot: https://github.com/ashtonmeuser/godot-wasm
WasmEdge can be embedded in applications: https://wasmedge.org/docs/embed/overview
Wasmer can be embedded in applications: https://blog.wasmer.io/executing-webassembly-in-your-rust-ap...
Wasmtime can be embedded in applications: https://docs.wasmtime.dev/lang.html
-
terra
Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
If you like Lua, see Terra, https://terralang.org/
> Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.. Like C/C++, Terra is a statically-typed, compiled language with manual memory management. But unlike C/C++, it is designed from the beginning to be meta-programmed from Lua.. In Terra, we just gave in to the trend of making the meta-language of C/C++ more powerful and replaced it with a real programming language, Lua.
-
Luau (developed by Roblox) is a fork of Lua 5.1 with some very significant improvements to speed and QoL. It also alleviates the nil-terminated array problem.
https://github.com/luau-lang/luau
-
sol2
Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
The Lua C API is fantastic from a design perspective, but as you have discovered, it is rather error prone. Fortunately, there are many wrapper libraries that take care of all the stack manipulation. For example, I'm using https://github.com/ThePhD/sol2 to interface with C++ and the API is incredibly ergonomic.
-
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
I agree. Also tables are quite weird, and 1-based indexing is definitely a mistake (sorry 1 fans but it is).
I think it just doesn't have much competition in the "embeddable languages" space unfortunately.
As another commenter said, JavaScript is probably the best choice in most cases today.
There's a list of options here but most of them are not really good options usually:
https://github.com/dbohdan/embedded-scripting-languages
E.g. Python would be a terrible choice in most cases. Awk? Some of them aren't even general purpose programming languages like Dhall.
If you narrow it down to embeddable-like-Lua there are hardly any.
-
moddable
Tools for developers to create truly open IoT products using standard JavaScript on low cost microcontrollers.
-
-
I feel like this post doesn't really get into what I like about Lua, which is pretty unfortunate.
I'm not a huge Lua fan. Though on projects with others I'll use whatever language they're using, left to my own devices, I probably write about 3× as much JS as Lua, about 32× as much Python as Lua, and about 20× as much C as Lua.
But Lua has some really nice features.
First, LuaJIT is motherfucking alien technology from the future. I wrote a straightforward escape-time fractal renderer in https://gitlab.com/kragen/bubbleos/-/blob/master/yeso/mand.l... with a dynamic function invocation in the inner loop (to switch between fractals) and LuaJIT's trace compilation just compiles that right out. You can literally just write high-level code at like a Python or JavaScript level and, as often as not, it just goes faster than C. (Sometimes it doesn't. JIT compilers are unpredictable and sometimes disappointing.)
Now, probably somebody is going to reply to this and tell me that everybody runs JS in JIT compilers too, so this isn't a real difference. Unfortunately that's bullshit. I'm sorry, but V8 and SpiderMonkey are just not in the same league, though not because their implementors are less brilliant. They're just attempting a much harder job, because JS is a much hairier language.
LuaJIT's C FFI is also just, there's no expression in English sufficiently emphatic to express its wonderfulness. Here we might say it's the very child of ten thousand whores. Here's the FFI binding for Yeso, the graphics library used for the above fractal demo: https://gitlab.com/kragen/bubbleos/-/blob/master/yeso/yeso.l...
(to be continued)
-
I just started using lua and have types in vscode using lua annotations. https://github.com/LuaLS/lua-language-server/wiki/Annotation...
-
Spring RTS game engine
A powerful free cross-platform RTS game engine. - Report issues at https://springrts.com/mantis/ (by spring)
In the Spring/Recoil RTS game engine[1] we adapted Lua to have deterministic execution allowing synchronous multiplayer simulation. In addition we relatively easily implemented a precise[2] serialization of the Lua VM, allowing us to support save/load for games with no code required from their side.
In other languages these would require much more effort.
[1] https://github.com/spring/spring or https://github.com/beyond-all-reason/spring (yay for forks!)
[2] Preserving the order of iteration on items in a hash table.
-
In the Spring/Recoil RTS game engine[1] we adapted Lua to have deterministic execution allowing synchronous multiplayer simulation. In addition we relatively easily implemented a precise[2] serialization of the Lua VM, allowing us to support save/load for games with no code required from their side.
In other languages these would require much more effort.
[1] https://github.com/spring/spring or https://github.com/beyond-all-reason/spring (yay for forks!)
[2] Preserving the order of iteration on items in a hash table.
-
-
-
-
-
-
Luon
A compiler and IDE for the Luon programming language - a liaison beween Lua and Oberon+ - targeting LuaJIT
Maybe it's time to check out Luon [1], which has a syntax similar to Oberon and takes some concepts from Lua, it's statically typed and targets the LuaJIT VM. It was recently covered in HN [2]
[1] https://github.com/rochus-keller/Luon/blob/master/Readme.md
-
To be able to embed WASM-compiled languages for embedding you first need a small WASM runtime you can depend on (and things like ref types, GC etc which have been standardized only in the last couple of years).
That didn't exist until recently, but now you can use https://github.com/bytecodealliance/wasm-micro-runtime/blob/...
I am not aware of anyone using this yet, but I hope to see that become common in the next few years.
-
The WebAssembly component model is aimed at having composable components that can call each other. The components can be written in any language, compiled to WebAssembly, and interoperate: https://github.com/WebAssembly/component-model/
Extism is a plugin framework for WebAssembly:
https://extism.org/
https://github.com/extism/extism
Visual Studio Code can run WebAssembly extensions: https://code.visualstudio.com/blogs/2024/05/08/wasm
A project to bring WebAssembly plugins to Godot: https://github.com/ashtonmeuser/godot-wasm
WasmEdge can be embedded in applications: https://wasmedge.org/docs/embed/overview
Wasmer can be embedded in applications: https://blog.wasmer.io/executing-webassembly-in-your-rust-ap...
Wasmtime can be embedded in applications: https://docs.wasmtime.dev/lang.html
-
The WebAssembly component model is aimed at having composable components that can call each other. The components can be written in any language, compiled to WebAssembly, and interoperate: https://github.com/WebAssembly/component-model/
Extism is a plugin framework for WebAssembly:
https://extism.org/
https://github.com/extism/extism
Visual Studio Code can run WebAssembly extensions: https://code.visualstudio.com/blogs/2024/05/08/wasm
A project to bring WebAssembly plugins to Godot: https://github.com/ashtonmeuser/godot-wasm
WasmEdge can be embedded in applications: https://wasmedge.org/docs/embed/overview
Wasmer can be embedded in applications: https://blog.wasmer.io/executing-webassembly-in-your-rust-ap...
Wasmtime can be embedded in applications: https://docs.wasmtime.dev/lang.html
-
quickjs-emscripten
Safely execute untrusted Javascript in your Javascript, and execute synchronous code that uses async functions
I’m not sure if wasm would be considered full process isolation but it does provide a software based sandboxing. I’m referring to running quickjs in wasm by compiling it with emscripten.
https://github.com/justjake/quickjs-emscripten
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives