Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
3.9 KiB

  1. <!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>LUA man page</TITLE>
  5. <LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
  6. </HEAD>
  7. <BODY BGCOLOR="#FFFFFF">
  8. <H2>NAME</H2>
  9. lua - Lua interpreter
  10. <H2>SYNOPSIS</H2>
  11. <B>lua</B>
  12. [
  13. <I>options</I>
  14. ]
  15. [
  16. <I>script</I>
  17. [
  18. <I>args</I>
  19. ]
  20. ]
  21. <H2>DESCRIPTION</H2>
  22. <B>lua</B>
  23. is the stand-alone Lua interpreter.
  24. It loads and executes Lua programs,
  25. either in textual source form or
  26. in precompiled binary form.
  27. (Precompiled binaries are output by
  28. <B>luac</B>,
  29. the Lua compiler.)
  30. <B>lua</B>
  31. can be used as a batch interpreter and also interactively.
  32. <P>
  33. The given
  34. <I>options</I>
  35. (see below)
  36. are executed and then
  37. the Lua program in file
  38. <I>script</I>
  39. is loaded and executed.
  40. The given
  41. <I>args</I>
  42. are available to
  43. <I>script</I>
  44. as strings in a global table named
  45. <B>arg</B>.
  46. If these arguments contain spaces or other characters special to the shell,
  47. then they should be quoted
  48. (but note that the quotes will be removed by the shell).
  49. The arguments in
  50. <B>arg</B>
  51. start at 0,
  52. which contains the string
  53. '<I>script</I>'.
  54. The index of the last argument is stored in
  55. <B>arg.n</B>.
  56. The arguments given in the command line before
  57. <I>script</I>,
  58. including the name of the interpreter,
  59. are available in negative indices in
  60. <B>arg</B>.
  61. <P>
  62. At the very start,
  63. before even handling the command line,
  64. <B>lua</B>
  65. executes the contents of the environment variable
  66. <B>LUA_INIT</B>,
  67. if it is defined.
  68. If the value of
  69. <B>LUA_INIT</B>
  70. is of the form
  71. '@<I>filename</I>',
  72. then
  73. <I>filename</I>
  74. is executed.
  75. Otherwise, the string is assumed to be a Lua statement and is executed.
  76. <P>
  77. Options start with
  78. <B>'-'</B>
  79. and are described below.
  80. You can use
  81. <B>'--'</B>
  82. to signal the end of options.
  83. <P>
  84. If no arguments are given,
  85. then
  86. <B>"-v -i"</B>
  87. is assumed when the standard input is a terminal;
  88. otherwise,
  89. <B>"-"</B>
  90. is assumed.
  91. <P>
  92. In interactive mode,
  93. <B>lua</B>
  94. prompts the user,
  95. reads lines from the standard input,
  96. and executes them as they are read.
  97. If a line does not contain a complete statement,
  98. then a secondary prompt is displayed and
  99. lines are read until a complete statement is formed or
  100. a syntax error is found.
  101. So, one way to interrupt the reading of an incomplete statement is
  102. to force a syntax error:
  103. adding a
  104. <B>';'</B>
  105. in the middle of a statement is a sure way of forcing a syntax error
  106. (except inside multiline strings and comments; these must be closed explicitly).
  107. If a line starts with
  108. <B>'='</B>,
  109. then
  110. <B>lua</B>
  111. displays the values of all the expressions in the remainder of the
  112. line. The expressions must be separated by commas.
  113. The primary prompt is the value of the global variable
  114. <B>_PROMPT</B>,
  115. if this value is a string;
  116. otherwise, the default prompt is used.
  117. Similarly, the secondary prompt is the value of the global variable
  118. <B>_PROMPT2</B>.
  119. So,
  120. to change the prompts,
  121. set the corresponding variable to a string of your choice.
  122. You can do that after calling the interpreter
  123. or on the command line
  124. (but in this case you have to be careful with quotes
  125. if the prompt string contains a space; otherwise you may confuse the shell.)
  126. The default prompts are "&gt; " and "&gt;&gt; ".
  127. <H2>OPTIONS</H2>
  128. <P>
  129. <B>-</B>
  130. load and execute the standard input as a file,
  131. that is,
  132. not interactively,
  133. even when the standard input is a terminal.
  134. <P>
  135. <B>-e </B><I>stat</I>
  136. execute statement
  137. <I>stat</I>.
  138. You need to quote
  139. <I>stat </I>
  140. if it contains spaces, quotes,
  141. or other characters special to the shell.
  142. <P>
  143. <B>-i</B>
  144. enter interactive mode after
  145. <I>script</I>
  146. is executed.
  147. <P>
  148. <B>-l </B><I>name</I>
  149. call
  150. <B>require</B>('<I>name</I>')
  151. before executing
  152. <I>script</I>.
  153. Typically used to load libraries.
  154. <P>
  155. <B>-v</B>
  156. show version information.
  157. <H2>SEE ALSO</H2>
  158. <B>luac</B>(1)
  159. <BR>
  160. <A HREF="http://www.lua.org/">http://www.lua.org/</A>
  161. <H2>DIAGNOSTICS</H2>
  162. Error messages should be self explanatory.
  163. <H2>AUTHORS</H2>
  164. R. Ierusalimschy,
  165. L. H. de Figueiredo,
  166. and
  167. W. Celes
  168. <!-- EOF -->
  169. </BODY>
  170. </HTML>