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