{"repo":"ceifa/wasmoon","free":true,"listed":false,"github":"https://github.com/ceifa/wasmoon","clone":"git clone https://github.com/ceifa/wasmoon.git","description":"A real lua 5.4 VM with JS bindings made with webassembly","language":"TypeScript","stars":692,"topics":["lua","fengari","webassembly","javascript","nodejs"],"license":"MIT","category":"cli-tools","readme_excerpt":"Wasmoon This package aims to provide a way to: - Embed Lua to any Node.js, Deno or Web Application. - Run lua code in any operational system - Interop Lua and JS without memory leaks (including the DOM) API Usage To initialize, create a new Lua state, register the standard library, set a global variable, execute a code and get a global variable: CLI Usage Although Wasmoon has been designed to be embedded, you can run it on command line as well, but, if you want something more robust on this, we recommend to take a look at demoon. Available options are: - -l : Include a file or directory - -i : Enter interactive mode after running the files Example: And if you are in Unix, you can also use it as a script interpreter with Shebang: When to use wasmoon and fengari Wasmoon compiles the official Lua code to webassembly and creates an abstraction layer to interop between Lua and JS, instead of fengari, that is an entire Lua VM rewritten in JS. Performance Because of wasm, wasmoon will run Lua code much faster than fengari, but if you are going to interop a lot between JS and Lua, this may be not be true anymore, you probably should test on you specific use case to take the prove. This is the results running a heap sort code in a list of 2k numbers 10x(less is better): wasmoon fengari -------- --------- 15.267ms 389.923ms Size Fengari is smaller than wasmoon, which can improve the user experience if in web environments: wasmoon fengari ----------- ------- ------- plain 393kB 214kB gz","default_branch":null,"files":null,"tree":[],"storefront":"/r/ceifa","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ceifa/wasmoon/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}