{"id":13611868,"url":"https://github.com/SwadicalRag/wasm2lua","last_synced_at":"2025-04-13T05:33:52.078Z","repository":{"id":45423530,"uuid":"183629989","full_name":"SwadicalRag/wasm2lua","owner":"SwadicalRag","description":"wasm2lua: converting WASM into Lua","archived":false,"fork":false,"pushed_at":"2021-12-14T20:25:24.000Z","size":2374,"stargazers_count":201,"open_issues_count":15,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-09T15:03:03.227Z","etag":null,"topics":["compiler","lua","luajit","transpiler","wasi","wasm","wasm2lua","webassembly"],"latest_commit_sha":null,"homepage":"","language":"WebAssembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwadicalRag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-26T13:05:18.000Z","updated_at":"2025-03-30T19:33:42.000Z","dependencies_parsed_at":"2022-08-12T20:50:09.559Z","dependency_job_id":null,"html_url":"https://github.com/SwadicalRag/wasm2lua","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwadicalRag%2Fwasm2lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwadicalRag%2Fwasm2lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwadicalRag%2Fwasm2lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwadicalRag%2Fwasm2lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwadicalRag","download_url":"https://codeload.github.com/SwadicalRag/wasm2lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670514,"owners_count":21142896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","lua","luajit","transpiler","wasi","wasm","wasm2lua","webassembly"],"created_at":"2024-08-01T19:02:16.487Z","updated_at":"2025-04-13T05:33:47.066Z","avatar_url":"https://github.com/SwadicalRag.png","language":"WebAssembly","readme":"# 🎉 wasm2lua 🎊\n\n![](https://forthebadge.com/images/badges/powered-by-electricity.svg) ![](https://forthebadge.com/images/badges/made-with-crayons.svg)\n\n[![travis ci](https://travis-ci.com/SwadicalRag/wasm2lua.svg?branch=master)](https://travis-ci.com/SwadicalRag/wasm2lua)\n\nHave YOU ever wanted to run C++/C/Rust/javascript/banana/etc. on Lua without using native modules?\n\nGOOD 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!\n\n## Notes\n\n - The generated code is heavily dependent upon the LuaJIT bit library\n - Some of `@webassemblyjs`'s libraries are monkey patched at runtime\n - `luamin` is monkey patched at runtime\n - The WASI API is still under heavy development\n - Emscripten is NOT supported out of the box. You will need to compile things via the WASI ecosystem.\n\n# Usage\n\n`wasm2lua \u003cin.wasm\u003e \u003cout.lua\u003e`\n\n`lua-webidl \u003cin.idl\u003e \u003cout.cpp\u003e --cpp`\n\n(Run those commands with `--help` for other options)\n\nSee `HOWTO-BINDINGS.md` in this repository for reference on how to use the WebIDL binder.\n\n## Installation\n\n`npm i -g wasm2lua`\n\n# Projects that use `wasm2lua`\n\n - [bullet3-lua](https://github.com/SwadicalRag/bullet3-lua) ([Releases](https://github.com/SwadicalRag/bullet3-lua/releases/), [Demo](https://github.com/SwadicalRag/bullet3-lua/blob/master/test.lua)), built with CMake\n - [brotli-lua](https://github.com/SwadicalRag/brotli-lua) ([Releases](https://github.com/SwadicalRag/brotli-lua/releases/), [Demo](https://github.com/SwadicalRag/brotli-lua/blob/master/test.lua)), built with CMake\n - [tiny-regex-lua](https://github.com/SwadicalRag/tiny-regex-lua) ([Demo](https://github.com/SwadicalRag/tiny-regex-lua/blob/master/test.lua)), built with a Makefile\n\n### BONUS: duktape via wasm2lua\n\n```c\nint main(int argc, char *argv[]) {\n\tduk_context *ctx = duk_create_heap_default();\n\n\t(void) argc; (void) argv;  /* suppress warning */\n\n\tduk_push_c_function(ctx, native_print, DUK_VARARGS);\n\tduk_put_global_string(ctx, \"print\");\n\tduk_push_c_function(ctx, native_adder, DUK_VARARGS);\n\tduk_put_global_string(ctx, \"adder\");\n\n\tduk_eval_string(ctx, \"print('Hello world!');\");\n\n\tduk_eval_string(ctx, \"print('2+3=' + adder(2, 3));\");\n\tduk_pop(ctx);  /* pop eval result */\n\n\tduk_destroy_heap(ctx);\n\n\treturn 0;\n}\n\n```\n\n![duktape demo](resources/img/duktape.png)\n","funding_links":[],"categories":["WebAssembly"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwadicalRag%2Fwasm2lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwadicalRag%2Fwasm2lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwadicalRag%2Fwasm2lua/lists"}