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