luac.html 3.8 KB

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