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 containing precompiled chunks
14 that can be later loaded and 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. Precompiling does not imply faster execution because in Lua
19 chunks are always compiled into bytecodes before being executed. luac
20 simply allows those bytecodes to be saved in a file for later execu‐
21 tion. Precompiled chunks are not necessarily smaller than the corre‐
22 sponding source. The main goal in precompiling is faster loading.
23
24 In the command line, you can mix text files containing Lua source and
25 binary files containing precompiled chunks. luac produces a single
26 output file containing the combined bytecodes for all files given.
27 Executing the combined file is equivalent to executing the given files.
28 By default, the output file is named luac.out, but you can change this
29 with the -o option.
30
31 Precompiled chunks are not portable across different architectures.
32 Moreover, the internal format of precompiled chunks is likely to change
33 when a new version of Lua is released. Make sure you save the source
34 files of all Lua programs that you precompile.
35
37 -l produce a listing of the compiled bytecode for Lua's virtual
38 machine. Listing bytecodes is useful to learn about Lua's vir‐
39 tual machine. If no files are given, then luac loads luac.out
40 and lists its contents. Use -l -l for a full listing.
41
42 -o file
43 output to file, instead of the default luac.out. (You can use
44 '-' for standard output, but not on platforms that open standard
45 output in text mode.) The output file may be one of the given
46 files because all files are loaded before the output file is
47 written. Be careful not to overwrite precious files.
48
49 -p load files but do not generate any output file. Used mainly for
50 syntax checking and for testing precompiled chunks: corrupted
51 files will probably generate errors when loaded. If no files
52 are given, then luac loads luac.out and tests its contents. No
53 messages are displayed if the file loads without errors.
54
55 -s strip debug information before writing the output file. This
56 saves some space in very large chunks, but if errors occur when
57 running a stripped chunk, then the error messages may not con‐
58 tain the full information they usually do. In particular, line
59 numbers and names of local variables are lost.
60
61 -v show version information.
62
63 -- stop handling options.
64
65 - stop handling options and process standard input.
66
68 lua(1)
69 The documentation at lua.org.
70
72 Error messages should be self explanatory.
73
75 R. Ierusalimschy, L. H. de Figueiredo, W. Celes
76
77
78
79 $Date: 2011/11/16 13:53:40 $ LUAC(1)