loading...

Reaching out, WASM help. Embedding Lua.

adam_cyclones profile image Adam Crockett ・2 min read

Intent

https://github.com/acronamy/wasm-lua-node-tidal

I have been working on this experiment for a little while now, its maddening, I'm fairly sure I am 99% of the way but I have hit a roadblock.

I have a desire to call Lua from node.js as a WASM module, there are some existing projects but they focus on Lua in browser, I see a different potential for Lua - despite the listing for one of the worst programing languages this year, (based on usage, like saying my screwdriver is bad at screwing because I don't use it much) - I have this year fallen in love with Lua.

Much like the creator of the popular Lovit framework, I want to have a much faster alternative to V8 available but also a nice and familiar application, but this project differs, Instead of replacing node, lets use Lua as it was intended, an embedded scripting language running transparently together with node.js, not replacing it just complementing it.

What do you want from me?

So yeah let's get to the point, This is my first and likely unsuccessful callout to the community, you don't need to know much about Lua, but if your into emscripten and mentor me, or can get my application to compile and run. or put in a PR, I would be so grateful, I am at a point where I can ccall my _run_lua function but I get a memory out of bounds error. No idea...

Where am I going with this?

I would like to get the fantastic Love2D game engine working in html canvas at near native speeds. I would also like to get open-resty integrated, I have a lot of ideas.

Thanks for reading!

Posted on by:

adam_cyclones profile

Adam Crockett

@adam_cyclones

I work at ForgeRock as Staff UI Engineer, I play with all sorts really. Lately WASM is my toy of interest.

Discussion

markdown guide
 

I would start with adding build instruction to Readme, so people could easily jump to experimenting. If it requires native dependencies it would be nice to provide Docker file.

Not sure this will help, but here is mruby compiled down to wasm github.com/xxuejie/webruby, maybe you can check what they're doing.

 

Excelent suggestions! thanks stereobooster!

 

As of tonight, Lua VM is running in node via emscripten and c++, there are many new challenges to face but at least they are mostly around language interop. This is very exciting! Also a lot to clean up and refactor too, so much rage in this project 😂.

 

Lookup embind if you find this article and use the glue code generated by emscripten. My repo will explain all as soon as I merge the ok other branch in the coming days.