{"library":"lua2js","title":"Lua2JS","description":"A Lua parser and transpiler to JavaScript that generates Mozilla Parser API ASTs. The current version is 0.0.11, with no recent releases or active development evident. It targets Lua 5.1 with partial support and aims to run unmodified Lua programs in JavaScript environments. Unlike other Lua transpilers, it provides options for Lua-JS interop such as automatic conversion of LuaTable to arrays/objects and method call syntax remapping. It requires no runtime dependencies and is distributed as a single minified file. The project has significant gaps: many standard library functions (e.g., string.format, pattern matching, coroutines, debug) are missing, and certain Lua syntax features (expression table keys, goto) are unsupported. The repository appears to be in maintenance or abandoned state.","language":"javascript","status":"abandoned","last_verified":"Fri May 01","install":{"commands":["npm install lua2js"],"cli":{"name":"lua2js","version":null}},"imports":["import lua2js from 'lua2js'","import { parse } from 'lua2js'","import { translate } from 'lua2js'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import lua2js from 'lua2js';\n\nconst luaCode = `\nfunction fib(n)\n    if n < 2 then\n        return n\n    else\n        return fib(n-1) + fib(n-2)\n    end\nend\nprint(fib(10))\n`;\n\nconst ast = lua2js.parse(luaCode);\nconst jsCode = lua2js.translate(ast);\nconsole.log(jsCode);\n// Output:\n// var fib = function(n) {\n//   if (n < 2) {\n//     return n;\n//   } else {\n//     return fib(n - 1) + fib(n - 2);\n//   }\n// };\n// console.log(fib(10));","lang":"typescript","description":"Parses a Lua Fibonacci function and translates it to JavaScript, demonstrating basic usage of parse and translate.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}