{"id":18345554,"url":"https://github.com/typescripttolua/lua-wasm-bindings","last_synced_at":"2026-03-09T04:07:54.677Z","repository":{"id":41868461,"uuid":"343904806","full_name":"TypeScriptToLua/lua-wasm-bindings","owner":"TypeScriptToLua","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-01T08:39:01.000Z","size":214,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-14T07:54:01.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TypeScriptToLua.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-02T20:32:46.000Z","updated_at":"2024-06-29T16:42:13.000Z","dependencies_parsed_at":"2022-08-11T19:40:51.786Z","dependency_job_id":null,"html_url":"https://github.com/TypeScriptToLua/lua-wasm-bindings","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TypeScriptToLua%2Flua-wasm-bindings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TypeScriptToLua%2Flua-wasm-bindings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TypeScriptToLua%2Flua-wasm-bindings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TypeScriptToLua%2Flua-wasm-bindings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TypeScriptToLua","download_url":"https://codeload.github.com/TypeScriptToLua/lua-wasm-bindings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223245079,"owners_count":17112572,"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":[],"created_at":"2024-11-05T21:08:39.766Z","updated_at":"2026-03-09T04:07:54.617Z","avatar_url":"https://github.com/TypeScriptToLua.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Lua WASM Bindings\n\nWASM bindings and binaries for Lua 5.0 to 5.4.\n\nMake sure to run `./scripts/setup.sh` (requires emscripten sdk) first before using `npm run build`.\n\n### Important: This currently only includes the bindings used to test TypescriptToLua\n\nIn the future Bindings for the complete API may be added.\n\n### Example\n\n```ts\nimport { LUA_OK } from \"lua-wasm-bindings/dist/lua\";\n\nimport { lauxlib, lua, lualib } from \"lua-wasm-bindings/dist/lua.54\";\n\nconst luaCode = `return \"Hello\"`;\nconsol.log(executeLua(luaCode));\n\nfunction executeLua(luaCode: string): string | Error | never {\n  const L = lauxlib.luaL_newstate();\n  lualib.luaL_openlibs(L);\n\n  // Optional Load modules\n  // lua.lua_getglobal(L, \"package\");\n  // lua.lua_getfield(L, -1, \"preload\");\n  // lauxlib.luaL_loadstring(L, jsonLib); // Load extenal package from string\n  // lua.lua_setfield(L, -2, \"json\");\n\n  const status = lauxlib.luaL_dostring(L, luaCode);\n\n  if (status === LUA_OK) {\n    if (lua.lua_isstring(L, -1)) {\n      const result = lua.lua_tostring(L, -1);\n      lua.lua_close(L);\n      return result === null ? undefined : result;\n    } else {\n      const returnType = lua.lua_typename(L, lua.lua_type(L, -1));\n      lua.lua_close(L);\n      throw new Error(`Unsupported Lua return type: ${returnType}`);\n    }\n  } else {\n    const luaStackString = lua.lua_tostring(L, -1);\n    const message = luaStackString.replace(/^\\[string \"(--)?\\.\\.\\.\"\\]:\\d+: /, \"\");\n    lua.lua_close(L);\n    return new Error(message);\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescripttolua%2Flua-wasm-bindings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypescripttolua%2Flua-wasm-bindings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescripttolua%2Flua-wasm-bindings/lists"}