LUAC(1)
π NAME π
luac β the Lua compiler, bestie. she takes your Lua and squishes it into bytecode. iconic behavior honestly.
β¨ SYNOPSIS β¨
luac [ options ] [ filenames ]
π¦ DESCRIPTION π¦
luac is the Lua compiler, no cap. She translates programs written in the Lua programming language into binary files that can be later loaded and executed. it's giving β¨pipelineβ¨.
The main advantages of precompiling chunks are: faster loading, protecting source code from accidental user changes, and off-line syntax checking. three for three, she ate.
okay but listen β pre-compiling does NOT imply faster execution, bestie. that's the plot twist. in Lua, chunks are always compiled into bytecodes before being executed anyway. luac simply allows those bytecodes to be saved in a file for later execution. so it's not a speed cheat code for runtime, it's a speed cheat code for loading time. iykyk.
Also not me having to say this: pre-compiled chunks are not necessarily smaller than the corresponding source. the main goal in pre-compiling is faster loading. that's it. that's the goal. π―
The binary files created by luac are portable only among architectures with the same word size and byte order. so like, don't be sending these around to your weird little endian-flipped cousin and expecting it to work. π
luac produces a single output file containing the bytecodes for all source files given. By default, the output file is named luac.out, but you can change this with the -o option. one file to rule them all fr fr π
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. girl math but make it bytecode.
You can use '-' to indicate the standard input as a source file and '--' to signal the end of options (that is, all remaining arguments will be treated as files even if they start with '-'). very demure, very mindful. π
π¨ IMPORTANT WARNING, READ THIS TWICE π¨ The internal format of the binary files produced by luac is likely to change when a new version of Lua is released. So, save the source files of all Lua programs that you precompile. SAVE THE SOURCE. ALWAYS. your future self will thank you, periodt.
π OPTIONS π
okay so quick rule first: Options must be separate. don't be smooshing them together, she's not that kind of girl.
-lβ produce a listing of the compiled bytecode for Lua's virtual machine. Listing bytecodes is useful to learn about Lua's virtual machine. If no files are given, thenluacloadsluac.outand lists its contents. honestly this is the nerd snipe option, you WILL get obsessed with reading bytecode. π-ofile β 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 a source file because all files are loaded before the output file is written. Be careful not to overwrite precious files. π«Ά like genuinely, don't aim this at your only copy of anything. that's not slay, that's a tragedy.-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. Lua always performs a thorough integrity test on precompiled chunks. Bytecode that passes this test is completely safe, in the sense that it will not break the interpreter. However, there is no guarantee that such code does anything sensible. (None can be given, because the halting problem is unsolvable.) π yeah. the halting problem. she said what she said. If no files are given, thenluacloadsluac.outand tests its contents. No messages are displayed if the file passes the integrity test β silence is the sound of success β¨-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. For instance, line numbers and names of local variables are lost. π so like, smaller file but you lose the receipts. your call bestie.-vβ show version information. short king of an option. π
πΈ FILES πΈ
luac.outβ default output file. that's her. that's the girl.
π SEE ALSO π
π DIAGNOSTICS π
Error messages should be self explanatory. they're not cryptic on purpose, she's just honest. π§
π AUTHORS π
L. H. de Figueiredo, R. Ierusalimschy and W. Celes β the actual legends, the main characters, the ones who built this whole thing. we stan. π«Ά
aaaand that's a wrap, bestie!! π this page is from the General Commands Manual (you know, LUAC(1)), and it's stamped $Date: 2006/01/06 16:03:34 $ β a certified classic from way back. go compile something cute. βπΈπ
π¦ where this page comes from
- epel 10: compat-lua 5.1.5-25.el10_0 Β· MIT
- epel 9: compat-lua 5.1.5-20.el9 Β· MIT
- fedora 43: compat-lua 5.1.5-29.fc43 Β· MIT
- fedora 44: compat-lua 5.1.5-31.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms