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