{"id":18437106,"url":"https://github.com/mfussenegger/nlua","last_synced_at":"2025-10-04T13:57:03.713Z","repository":{"id":205578753,"uuid":"714577863","full_name":"mfussenegger/nlua","owner":"mfussenegger","description":"Neovim as Lua interpreter","archived":false,"fork":false,"pushed_at":"2025-05-22T08:42:27.000Z","size":32,"stargazers_count":70,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-22T09:42:47.393Z","etag":null,"topics":["interpreter","lua","neovim"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mfussenegger.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["mfussenegger"]}},"created_at":"2023-11-05T09:27:49.000Z","updated_at":"2025-05-22T08:41:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"42ed133d-ef41-405e-8062-95dd51d17270","html_url":"https://github.com/mfussenegger/nlua","commit_stats":null,"previous_names":["mfussenegger/nlua"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mfussenegger/nlua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfussenegger%2Fnlua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfussenegger%2Fnlua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfussenegger%2Fnlua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfussenegger%2Fnlua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mfussenegger","download_url":"https://codeload.github.com/mfussenegger/nlua/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfussenegger%2Fnlua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278322146,"owners_count":25967874,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["interpreter","lua","neovim"],"created_at":"2024-11-06T06:13:40.793Z","updated_at":"2025-10-04T13:57:03.684Z","avatar_url":"https://github.com/mfussenegger.png","language":"Lua","readme":"# nlua\n\nLua script that lets you use Neovim as a Lua interpreter.\n\nNeovim embeds a Lua interpreter, but it doesn't expose the same command line interface as plain `lua`.\n\nThe plain interface looks like this:\n\n```\nusage: lua [options] [script [args]]\nAvailable options are:\n  -e stat   execute string 'stat'\n  -i        enter interactive mode after executing 'script'\n  -l mod    require library 'mod' into global 'mod'\n  -l g=mod  require library 'mod' into global 'g'\n  -v        show version information\n  -E        ignore environment variables\n  -W        turn warnings on\n  --        stop handling options\n  -         stop handling options and execute stdin\n```\n\n\n`nlua` is a script which emulates that interface, Using Neovim's `-l` option under the hood.\n\nCurrently supported:\n\n- `-e`\n- `-v`\n- `--`\n- `[script [args]]`\n- stdin handling\n\n\n## Motivation\n\n- It lets you use Neovim as Lua interpreter for [luarocks]. This in turn allows you to run tools like [busted] to test Neovim plugins.\n\n- It allows tools like [local-lua-debugger-vscode] to use the Neovim Lua. Enabling debugging of busted test cases for Neovim plugins.\n\nSee:\n\n- [Using Neovim as Lua interpreter with Luarocks](https://zignar.net/2023/01/21/using-luarocks-as-lua-interpreter-with-luarocks/)\n- [Debugging Lua in Neovim](https://zignar.net/2023/06/10/debugging-lua-in-neovim/)\n\n\n## Requirements\n\n- `env` executable supporting the `-S` option. Run `env --help` in a shell to verify.\n- Neovim 0.9+ with LuaJIT\n\n## Installation\n\n[![][luarocks-shield]][luarocks-pkg-url]\n\nThis package is available on [luarocks].\n\n- Install luarocks using a package manager. For example `pacman -S luarocks`\n- Install `nlua` via `luarocks`:\n\n    ```bash\n    luarocks --local install nlua\n    ```\n\n- Add `~/.luarocks/bin/nlua` to your `$PATH`:\n\n    ```bash\n    export PATH=$PATH:$HOME/.luarocks/bin:\n    ```\n\n- Confirm it's working:\n\n  ```bash\n  echo \"print(1 + 2)\" | nlua\n  ```\n\n\u003e [!NOTE]\n\u003e\n\u003e On Windows, luarocks will install a `nlua.bat` wrapper script.\n\n## Usage\n\n### Busted\n\n```bash\nluarocks --local install busted\nbusted --lua nlua spec/mytest_spec.lua\n```\n\nIf you see a `module 'busted.runner'` not found error you need to update your `LUA_PATH`:\n\n```bash\neval $(luarocks path --no-bin)\nbusted --lua nlua spec/mytest_spec.lua\n```\n\n### CI for Neovim Plugins\n\nYou can use the [plugin\ntemplate](https://github.com/nvim-lua/nvim-lua-plugin-template) to create a new\nrepository that contains nlua/busted based test setup.\n\n\n### As Lua interpreter for luarocks\n\n\nThis allows package installation directly via `nlua` instead of a system `lua`\n\nCreate a `~/.luarocks/config-nlua.lua` with the following contents.\n\nFor `luarocks 3.10.0` and above:\n\n```lua\nlua_version = \"5.1\"\nvariables = {\n   LUA = \"$HOME/.luarocks/bin/nlua\", -- path to where nlua is installed\n   LUA_INCDIR = \"/usr/include/luajit-2.1\",\n}\n```\n\nFor `luarocks 3.9.2` and below:\n\n```lua\nlua_version = \"5.1\"\nvariables = {\n   lua_interpreter = \"nlua\"\n   LUA_INCDIR = \"/usr/include/luajit-2.1\",\n   LUA_BINDIR = \"$HOME/.luarocks/bin\", -- path to where nlua is installed\n}\n```\n\nTo make using this custom configuration a bit easier, you can create a small wrapper.\nCreate a file called `nluarocks` somewhere in `$PATH` - e.g. in\n`~/.local/bin/nluarocks` - with the following content:\n\n```bash\n#!/usr/bin/env bash\n\nLUAROCKS_CONFIG=$HOME/.luarocks/config-nlua.lua luarocks --local \"$@\"\n```\n\nNow you should be able to install packages from `luarocks` using the `nvim`\nLua-interpreter. For example:\n\n```bash\nnluarocks install busted\n```\n\n\n[luarocks]: https://luarocks.org/\n[busted]: https://lunarmodules.github.io/busted/\n[local-lua-debugger-vscode]: https://github.com/tomblind/local-lua-debugger-vscode\n[luarocks-shield]: https://img.shields.io/luarocks/v/mfussenegger/nlua?logo=lua\u0026color=purple\u0026style=for-the-badge\n[luarocks-pkg-url]: https://luarocks.org/modules/mfussenegger/nlua\n","funding_links":["https://github.com/sponsors/mfussenegger"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfussenegger%2Fnlua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfussenegger%2Fnlua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfussenegger%2Fnlua/lists"}