Have YOU ever wanted to run C++/C/Rust/javascript/banana/etc. on Lua without using native modules?
GOOD NEWS, fam: wasm2lua can compile WebAssembly modules to pure Lua (or with FFI LuaJIT for extra speed). This means that anything that can be compiled to WASM can be compiled to Lua! Long Live John Lua!
@webassemblyjs's libraries are monkey patched at runtimeluamin is monkey patched at runtimewasm2lua <in.wasm> <out.lua>
lua-webidl <in.idl> <out.cpp> --cpp
(Run those commands with --help for other options)
See HOWTO-BINDINGS.md in this repository for reference on how to use the WebIDL binder.
npm i -g wasm2lua
wasm2luaint main(int argc, char *argv[]) {
duk_context *ctx = duk_create_heap_default();
(void) argc; (void) argv; /* suppress warning */
duk_push_c_function(ctx, native_print, DUK_VARARGS);
duk_put_global_string(ctx, "print");
duk_push_c_function(ctx, native_adder, DUK_VARARGS);
duk_put_global_string(ctx, "adder");
duk_eval_string(ctx, "print('Hello world!');");
duk_eval_string(ctx, "print('2+3=' + adder(2, 3));");
duk_pop(ctx); /* pop eval result */
duk_destroy_heap(ctx);
return 0;
}

106 commits
22 commits
WebAssembly
82.1%
TypeScript
12.5%
C
2.3%
JavaScript
2.0%
Lua
1.1%
Have YOU ever wanted to run C++/C/Rust/javascript/banana/etc. on Lua without using native modules?
GOOD NEWS, fam: wasm2lua can compile WebAssembly modules to pure Lua (or with FFI LuaJIT for extra speed). This means that anything that can be compiled to WASM can be compiled to Lua! Long Live John Lua!
@webassemblyjs's libraries are monkey patched at runtimeluamin is monkey patched at runtimewasm2lua <in.wasm> <out.lua>
lua-webidl <in.idl> <out.cpp> --cpp
(Run those commands with --help for other options)
See HOWTO-BINDINGS.md in this repository for reference on how to use the WebIDL binder.
npm i -g wasm2lua
wasm2luaint main(int argc, char *argv[]) {
duk_context *ctx = duk_create_heap_default();
(void) argc; (void) argv; /* suppress warning */
duk_push_c_function(ctx, native_print, DUK_VARARGS);
duk_put_global_string(ctx, "print");
duk_push_c_function(ctx, native_adder, DUK_VARARGS);
duk_put_global_string(ctx, "adder");
duk_eval_string(ctx, "print('Hello world!');");
duk_eval_string(ctx, "print('2+3=' + adder(2, 3));");
duk_pop(ctx); /* pop eval result */
duk_destroy_heap(ctx);
return 0;
}

106 commits
22 commits
WebAssembly
82.1%
TypeScript
12.5%
C
2.3%
JavaScript
2.0%
Lua
1.1%