1LUAC(1) General Commands Manual LUAC(1)
2
3
4
6 luac - Lua compiler
7
9 luac [ options ] [ filenames ]
10
12 luac is the Lua compiler. It translates programs written in the Lua
13 programming language into binary files that can be later loaded and
14 executed.
15
16 The main advantages of precompiling chunks are: faster loading, pro‐
17 tecting source code from accidental user changes, and off-line syntax
18 checking.
19
20 Pre-compiling does not imply faster execution because in Lua chunks are
21 always compiled into bytecodes before being executed. luac simply
22 allows those bytecodes to be saved in a file for later execution.
23
24 Pre-compiled chunks are not necessarily smaller than the corresponding
25 source. The main goal in pre-compiling is faster loading.
26
27 The binary files created by luac are portable only among architectures
28 with the same word size and byte order.
29
30 luac produces a single output file containing the bytecodes for all
31 source files given. By default, the output file is named luac.out, but
32 you can change this with the -o option.
33
34 In the command line, you can mix text files containing Lua source and
35 binary files containing precompiled chunks. This is useful to combine
36 several precompiled chunks, even from different (but compatible) plat‐
37 forms, into a single precompiled chunk.
38
39 You can use '-' to indicate the standard input as a source file and
40 '--' to signal the end of options (that is, all remaining arguments
41 will be treated as files even if they start with '-').
42
43 The internal format of the binary files produced by luac is likely to
44 change when a new version of Lua is released. So, save the source
45 files of all Lua programs that you precompile.
46
48 Options must be separate.
49
50 -l produce a listing of the compiled bytecode for Lua's virtual
51 machine. Listing bytecodes is useful to learn about Lua's vir‐
52 tual machine. If no files are given, then luac loads luac.out
53 and lists its contents.
54
55 -o file
56 output to file, instead of the default luac.out. (You can use
57 '-' for standard output, but not on platforms that open standard
58 output in text mode.) The output file may be a source file
59 because all files are loaded before the output file is written.
60 Be careful not to overwrite precious files.
61
62 -p load files but do not generate any output file. Used mainly for
63 syntax checking and for testing precompiled chunks: corrupted
64 files will probably generate errors when loaded. Lua always
65 performs a thorough integrity test on precompiled chunks. Byte‐
66 code that passes this test is completely safe, in the sense that
67 it will not break the interpreter. However, there is no guaran‐
68 tee that such code does anything sensible. (None can be given,
69 because the halting problem is unsolvable.) If no files are
70 given, then luac loads luac.out and tests its contents. No mes‐
71 sages are displayed if the file passes the integrity test.
72
73 -s strip debug information before writing the output file. This
74 saves some space in very large chunks, but if errors occur when
75 running a stripped chunk, then the error messages may not con‐
76 tain the full information they usually do. For instance, line
77 numbers and names of local variables are lost.
78
79 -v show version information.
80
82 luac.out default output file
83
85 lua(1)
86 http://www.lua.org/
87
89 Error messages should be self explanatory.
90
92 L. H. de Figueiredo, R. Ierusalimschy and W. Celes
93
94
95
96 $Date: 2006/01/06 16:03:34 $ LUAC(1)