]> git.saurik.com Git - redis.git/blame - deps/lua/doc/luac.1
Query the archive to provide a complete KEYS list.
[redis.git] / deps / lua / doc / luac.1
CommitLineData
21d3294c 1.\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $
2.TH LUAC 1 "$Date: 2006/01/06 16:03:34 $"
3.SH NAME
4luac \- Lua compiler
5.SH SYNOPSIS
6.B luac
7[
8.I options
9] [
10.I filenames
11]
12.SH DESCRIPTION
13.B luac
14is the Lua compiler.
15It translates programs written in the Lua programming language
16into binary files that can be later loaded and executed.
17.LP
18The main advantages of precompiling chunks are:
19faster loading,
20protecting source code from accidental user changes,
21and
22off-line syntax checking.
23.LP
24Pre-compiling does not imply faster execution
25because in Lua chunks are always compiled into bytecodes before being executed.
26.B luac
27simply allows those bytecodes to be saved in a file for later execution.
28.LP
29Pre-compiled chunks are not necessarily smaller than the corresponding source.
30The main goal in pre-compiling is faster loading.
31.LP
32The binary files created by
33.B luac
34are portable only among architectures with the same word size and byte order.
35.LP
36.B luac
37produces a single output file containing the bytecodes
38for all source files given.
39By default,
40the output file is named
41.BR luac.out ,
42but you can change this with the
43.B \-o
44option.
45.LP
46In the command line,
47you can mix
48text files containing Lua source and
49binary files containing precompiled chunks.
50This is useful to combine several precompiled chunks,
51even from different (but compatible) platforms,
52into a single precompiled chunk.
53.LP
54You can use
55.B "'\-'"
56to indicate the standard input as a source file
57and
58.B "'\--'"
59to signal the end of options
60(that is,
61all remaining arguments will be treated as files even if they start with
62.BR "'\-'" ).
63.LP
64The internal format of the binary files produced by
65.B luac
66is likely to change when a new version of Lua is released.
67So,
68save the source files of all Lua programs that you precompile.
69.LP
70.SH OPTIONS
71Options must be separate.
72.TP
73.B \-l
74produce a listing of the compiled bytecode for Lua's virtual machine.
75Listing bytecodes is useful to learn about Lua's virtual machine.
76If no files are given, then
77.B luac
78loads
79.B luac.out
80and lists its contents.
81.TP
82.BI \-o " file"
83output to
84.IR file ,
85instead of the default
86.BR luac.out .
87(You can use
88.B "'\-'"
89for standard output,
90but not on platforms that open standard output in text mode.)
91The output file may be a source file because
92all files are loaded before the output file is written.
93Be careful not to overwrite precious files.
94.TP
95.B \-p
96load files but do not generate any output file.
97Used mainly for syntax checking and for testing precompiled chunks:
98corrupted files will probably generate errors when loaded.
99Lua always performs a thorough integrity test on precompiled chunks.
100Bytecode that passes this test is completely safe,
101in the sense that it will not break the interpreter.
102However,
103there is no guarantee that such code does anything sensible.
104(None can be given, because the halting problem is unsolvable.)
105If no files are given, then
106.B luac
107loads
108.B luac.out
109and tests its contents.
110No messages are displayed if the file passes the integrity test.
111.TP
112.B \-s
113strip debug information before writing the output file.
114This saves some space in very large chunks,
115but if errors occur when running a stripped chunk,
116then the error messages may not contain the full information they usually do.
117For instance,
118line numbers and names of local variables are lost.
119.TP
120.B \-v
121show version information.
122.SH FILES
123.TP 15
124.B luac.out
125default output file
126.SH "SEE ALSO"
127.BR lua (1)
128.br
129http://www.lua.org/
130.SH DIAGNOSTICS
131Error messages should be self explanatory.
132.SH AUTHORS
133L. H. de Figueiredo,
134R. Ierusalimschy and
135W. Celes
136.\" EOF