Lua .gitignore template
The Lua template ignores compiled bytecode, packaged rock archives and the local dependency tree that the package manager installs into.
At a glance
- Category
- Language
- Patterns in this template
- 6 rules
- Directories ignored
- 2 of the 6 rules end in a slash, so they match directories only
- Also needs an OS template
- Yes. This template is small enough that most of your ignore file will come from elsewhere.
- Typical companions
- An editor template and an OS template, plus whatever host application you embed into.
In detail
luac.out is the default output name when you compile a script to bytecode with the standard compiler. Precompiled chunks load faster but they are tied to the interpreter version and the numeric format of the machine that produced them, so a chunk built on one platform can fail to load on another. Since the source is right there and compilation is instant, there is no reason to carry the output.
The rock rules cover *.rock, *.src.rock and *.zip.rock. These are the packaged formats the package manager produces: a source rock holds the sources plus the build recipe, a binary rock holds compiled output for a specific platform. They are release artefacts, published to a repository rather than committed alongside the sources they were built from.
lua_modules is the local dependency tree that gets created when you install into the project rather than system wide. It contains the full source of every dependency plus any compiled C extensions those dependencies needed, which are platform specific. The rockspec file is what makes it reproducible, and that is the file to track.
.luarocks is the per project configuration and cache directory the package manager writes alongside that tree, recording which tree to use and where the interpreter lives on this machine. Both are regenerated by a single install command, and both contain absolute paths that mean nothing on anyone else's computer, which is the usual reason a directory like this belongs outside version control.
Lua is usually embedded rather than run standalone, so the practical ignore file for a Lua project is often dominated by the host application. A game repository will need the engine's template, and a configuration heavy project may need nothing more than this plus an editor template.
Examples
luac.out
*.src.rock
*.zip.rock
*.rock
.luarocks/
lua_modules/6 lines exactly as the tool writes them, before any common additions you tick.
Things that catch people out
- *.rock also matches a data file that happens to use that extension, which is unlikely but worth knowing in a game repository with unusual asset names.
- Compiled C extensions inside lua_modules are platform specific, so ignoring the directory is what keeps a Linux build from receiving a colleague's macOS shared object.
- This template does not cover a configuration file holding credentials, which in embedded Lua projects is often a plain script the interpreter loads at startup.
Try it: .gitignore Generator
Pick one or more templates, tick the common additions you want, and copy or download the combined .gitignore.
.gitignore Generator
LOCAL · Browser-OnlyGenerate comprehensive .gitignore files by combining templates for languages, frameworks, IDEs, and operating systems
Language
Framework
IDE
OS
Build Tool
Infrastructure
Common Additions
Preview
Select templates or common additions to generate a .gitignore file.
Related .gitignore templates
All .gitignore templates →C .gitignore template
What the C .gitignore template covers: object files, static and shared libraries, linker maps, debug symbols and the patterns that swallow a vendored binary.
Vim .gitignore template
The Vim template uses character ranges to catch every swap file extension the editor cycles through, plus sessions, undo history and the netrw history.
Linux .gitignore template
The shortest template in the collection. Five rules covering editor backup files, file manager settings, per volume trash and NFS silly rename files.
Perl .gitignore template
The Perl template ignores the build library tree, generated metadata and coverage output, and its Makefile rule will also match a Makefile you wrote yourself.
Haskell .gitignore template
What the Haskell template covers: object and interface files, the dist output directories, profiling and event log output, and the local project overrides.
Elixir .gitignore template
The Elixir template anchors its rules to the project root and ignores compiled beam files, fetched dependencies, crash dumps and the secret config convention.
Tools for this
- .gitignore Generator Generate .gitignore files for any project - 50+ templates for languages, frameworks, IDEs, and OS