{"id":28413,"library":"tree-sitter-lua","title":"tree-sitter-lua","description":"Lua grammar for tree-sitter, providing incremental parsing and syntax tree queries for Lua code. Current version 0.5.0 (2025), supports Python >=3.10. Regenerated with tree-sitter 0.26.6. Release cadence is irregular, roughly semiannual.","status":"active","version":"0.5.0","language":"python","source_language":"en","source_url":"https://github.com/tree-sitter-grammars/tree-sitter-lua","tags":["tree-sitter","lua","parsing"],"install":[{"cmd":"pip install tree-sitter-lua","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required to load and use the grammar.","package":"tree-sitter","optional":false}],"imports":[{"note":"The grammar exposes a function `language_lua()` that returns a Language object.","symbol":"language_lua","correct":"from tree_sitter_lua import language_lua"}],"quickstart":{"code":"from tree_sitter import Language, Parser\nfrom tree_sitter_lua import language_lua\n\nLUA_LANGUAGE = Language(language_lua())\nparser = Parser()\nparser.set_language(LUA_LANGUAGE)\n\ntree = parser.parse(b\"print('hello world')\")\nprint(tree.root_node.sexp())","lang":"python","description":"Parses a Lua string and prints the S-expression of the syntax tree."},"warnings":[{"fix":"Upgrade tree-sitter: pip install --upgrade tree-sitter","message":"Version 0.4.0 regenerated the parser with ABI 15, breaking compatibility with tree-sitter <=0.24. Make sure your tree-sitter library is at least 0.25.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Use `from tree_sitter_lua import language_lua`","message":"The old import pattern `from tree_sitter_lua import language` (without underscore) is no longer supported after v0.1.0.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Run `pip install tree-sitter` before using tree-sitter-lua.","message":"The grammar version (0.5.0) does not match the tree-sitter library version. You must install tree-sitter separately.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install: pip install tree-sitter-lua","cause":"The package is not installed or the import path is wrong.","error":"ModuleNotFoundError: No module named 'tree_sitter_lua'"},{"fix":"Use: from tree_sitter_lua import language_lua","cause":"The function is named `language_lua`, not `language`.","error":"AttributeError: module 'tree_sitter_lua' has no attribute 'language'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}