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