LUAC(1)
π LUAC(1) β the general commands manual, but make it cute π
okay bestie, sit down, hydrate, because we're talking about luac, the Lua compiler π
β¨ NAME β¨
luac β the Lua compiler, no cap π
β¨ SYNOPSIS β¨
luac [ options ] [ filenames ]
that's it. that's the whole vibe check. options, then filenames, go π¦
β¨ DESCRIPTION β¨
so luac is literally the Lua compiler. it takes programs written in the Lua programming language and translates them into binary files containing precompiled chunks that you can load and execute later. it's giving meal prep but for bytecode π
the main advantages of precompiling chunks are:
- faster loading β‘
- protecting your source code from accidental user changes π‘οΈ
- off-line syntax checking β
and like, important β precompiling does not imply faster execution. in Lua, chunks are always compiled into bytecodes before being executed anyway. luac just lets those bytecodes be saved in a file for later execution. so it's not a speed hack, it's a storage situation, iykyk π
also, precompiled chunks are not necessarily smaller than the corresponding source. nope. the main goal in precompiling is faster loading. periodt π
on the command line you can mix text files containing Lua source and binary files containing precompiled chunks, and luac produces a single output file containing the combined bytecodes for all files given. executing the combined file is equivalent to executing the given files, fr fr π«Ά
by default the output file is named luac.out, but you can change that with the -o option. your file, your rules π
β οΈ okay this part matters: precompiled chunks are not portable across different architectures. and moreover, the internal format of precompiled chunks is likely to change when a new version of Lua is released. so please, for the love of everything, make sure you save the source files of all Lua programs that you precompile π keep the originals bestie, do not delete them πΈ
β¨ OPTIONS β¨
-lβ produce a listing of the compiled bytecode for Lua's virtual machine π§ listing bytecodes is genuinely useful if you wanna learn about Lua's virtual machine. if no files are given, thenluacloadsluac.outand lists its contents. use-l -lfor a full listing π-o fileβ output to file, instead of the defaultluac.out. (you can use'-'for standard output, but not on platforms that open standard output in text mode π« ) the output file may be one of the given files because all files are loaded before the output file is written. be careful not to overwrite precious files π-pβ load files but do not generate any output file. used mainly for syntax checking and for testing precompiled chunks: corrupted files will probably generate errors when loaded π©Ή if no files are given, thenluacloadsluac.outand tests its contents. no messages are displayed if the file loads without errors β silence is the success signal β¨-sβ strip debug information before writing the output file. this saves some space in very large chunks, but if errors occur when running a stripped chunk, then the error messages may not contain the full information they usually do π in particular, line numbers and names of local variables are lost. so like, tiny file, worse crime scenes π-vβ show version information π«--β stop handling options. that's the end of the option zone π-β stop handling options and process standard input π
β¨ SEE ALSO β¨
lua(1)π―- the documentation at lua.org π
β¨ DIAGNOSTICS β¨
error messages should be self explanatory. she tells you what's wrong, bestie, you just gotta read it π
β¨ AUTHORS β¨
R. Ierusalimschy, L. H. de Figueiredo, W. Celes π the icons who made this whole thing happen, we thank them π«Ά
and that's the whole page, gorgeous π
this was the $Date: 2011/11/16 13:53:40 $ edition of the general commands manual β yes that date is real, it's vintage, it's iconic, it's archival π go compile something cute β¨π¦π
π¦ where this page comes from
- arch rolling: lua 5.5.1-1 Β· MIT
- centos-stream 10: lua 5.4.8-1.el10 Β· MIT
- centos-stream 9: lua 5.4.4-4.el9 Β· MIT
- centos-stream 9: lua 5.4.4-4.el9 Β· MIT
- fedora 43: lua 5.4.8-2.fc43 Β· MIT
- fedora 43: lua 5.4.8-2.fc43 Β· MIT
- fedora 43: lua 5.4.8-4.fc43 Β· MIT
- fedora 43: lua 5.4.8-4.fc43 Β· MIT
- fedora 44: lua 5.4.8-5.fc44 Β· MIT
- fedora 44: lua 5.4.8-5.fc44 Β· MIT
- nixos 26.05: lua 5.5.1
- nixpkgs unstable: lua 5.5.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms