luac is the Lua compiler.
It translates programs written in the Lua programming language
into binary files that can be later loaded and executed.
The main advantages of precompiling chunks are:
protecting source code from accidental user changes,
off-line syntax checking.
Pre-compiling does not imply faster execution
because in Lua chunks are always compiled into bytecodes before being executed.
luac simply allows those bytecodes to be saved in a file for later execution.
Pre-compiled chunks are not necessarily smaller than the corresponding source.
The main goal in pre-compiling is faster loading.
The binary files created by
luac are portable only among architectures with the same word size and byte order.
luac produces a single output file containing the bytecodes
for all source files given.
the output file is named
luac.out, but you can change this with the
In the command line,
you can mix
text files containing Lua source and
binary files containing precompiled chunks.
This is useful to combine several precompiled chunks,
even from different (but compatible) platforms,
into a single precompiled chunk.
You can use
- to indicate the standard input as a source file
-- to signal the end of options
all remaining arguments will be treated as files even if they start with
The internal format of the binary files produced by
luac is likely to change when a new version of Lua is released.
save the source files of all Lua programs that you precompile.