beta-0.89.2
[luatex.git] / source / libs / lua52 / lua52-src / doc / luac.1
blob9d8f475f527f81f62082253bb1df80e1d6e37f31
1 .\" $Id: luac.man,v 1.29 2011/11/16 13:53:40 lhf Exp $\r
2 .TH LUAC 1 "$Date: 2011/11/16 13:53:40 $"\r
3 .SH NAME\r
4 luac \- Lua compiler\r
5 .SH SYNOPSIS\r
6 .B luac\r
7 [\r
8 .I options\r
9 ] [\r
10 .I filenames\r
11 ]\r
12 .SH DESCRIPTION\r
13 .B luac\r
14 is the Lua compiler.\r
15 It translates programs written in the Lua programming language\r
16 into binary files containing precompiled chunks\r
17 that can be later loaded and executed.\r
18 .LP\r
19 The main advantages of precompiling chunks are:\r
20 faster loading,\r
21 protecting source code from accidental user changes,\r
22 and\r
23 off-line syntax checking.\r
24 Precompiling does not imply faster execution\r
25 because in Lua chunks are always compiled into bytecodes before being executed.\r
26 .B luac\r
27 simply allows those bytecodes to be saved in a file for later execution.\r
28 Precompiled chunks are not necessarily smaller than the corresponding source.\r
29 The main goal in precompiling is faster loading.\r
30 .LP\r
31 In the command line,\r
32 you can mix\r
33 text files containing Lua source and\r
34 binary files containing precompiled chunks.\r
35 .B luac\r
36 produces a single output file containing the combined bytecodes\r
37 for all files given.\r
38 Executing the combined file is equivalent to executing the given files.\r
39 By default,\r
40 the output file is named\r
41 .BR luac.out ,\r
42 but you can change this with the\r
43 .B \-o\r
44 option.\r
45 .LP\r
46 Precompiled chunks are\r
47 .I not\r
48 portable across different architectures.\r
49 Moreover,\r
50 the internal format of precompiled chunks\r
51 is likely to change when a new version of Lua is released.\r
52 Make sure you save the source files of all Lua programs that you precompile.\r
53 .LP\r
54 .SH OPTIONS\r
55 .TP\r
56 .B \-l\r
57 produce a listing of the compiled bytecode for Lua's virtual machine.\r
58 Listing bytecodes is useful to learn about Lua's virtual machine.\r
59 If no files are given, then\r
60 .B luac\r
61 loads\r
62 .B luac.out\r
63 and lists its contents.\r
64 Use\r
65 .B \-l \-l\r
66 for a full listing.\r
67 .TP\r
68 .BI \-o " file"\r
69 output to\r
70 .IR file ,\r
71 instead of the default\r
72 .BR luac.out .\r
73 (You can use\r
74 .B "'\-'"\r
75 for standard output,\r
76 but not on platforms that open standard output in text mode.)\r
77 The output file may be one of the given files because\r
78 all files are loaded before the output file is written.\r
79 Be careful not to overwrite precious files.\r
80 .TP\r
81 .B \-p\r
82 load files but do not generate any output file.\r
83 Used mainly for syntax checking and for testing precompiled chunks:\r
84 corrupted files will probably generate errors when loaded.\r
85 If no files are given, then\r
86 .B luac\r
87 loads\r
88 .B luac.out\r
89 and tests its contents.\r
90 No messages are displayed if the file loads without errors.\r
91 .TP\r
92 .B \-s\r
93 strip debug information before writing the output file.\r
94 This saves some space in very large chunks,\r
95 but if errors occur when running a stripped chunk,\r
96 then the error messages may not contain the full information they usually do.\r
97 In particular,\r
98 line numbers and names of local variables are lost.\r
99 .TP\r
100 .B \-v\r
101 show version information.\r
102 .TP\r
103 .B \-\-\r
104 stop handling options.\r
105 .TP\r
106 .B \-\r
107 stop handling options and process standard input.\r
108 .SH "SEE ALSO"\r
109 .BR lua (1)\r
110 .br\r
111 The documentation at lua.org.\r
112 .SH DIAGNOSTICS\r
113 Error messages should be self explanatory.\r
114 .SH AUTHORS\r
115 R. Ierusalimschy,\r
116 L. H. de Figueiredo,\r
117 W. Celes\r
118 .\" EOF\r