lua.1 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. .TH LUA 1 "$Date: 2014/12/10 15:55:45 $"
  2. .SH NAME
  3. lua \- Lua interpreter
  4. .SH SYNOPSIS
  5. .B lua
  6. [
  7. .I options
  8. ]
  9. [
  10. .I script
  11. [
  12. .I args
  13. ]
  14. ]
  15. .SH DESCRIPTION
  16. .B lua
  17. is the standalone Lua interpreter.
  18. It loads and executes Lua programs,
  19. either in textual source form or
  20. in precompiled binary form.
  21. (Precompiled binaries are output by
  22. .BR luac ,
  23. the Lua compiler.)
  24. .B lua
  25. can be used as a batch interpreter and also interactively.
  26. .LP
  27. The given
  28. .I options
  29. are handled in order and then
  30. the Lua program in file
  31. .I script
  32. is loaded and executed.
  33. The given
  34. .I args
  35. are available to
  36. .I script
  37. as strings in a global table named
  38. .BR arg .
  39. If no options or arguments are given,
  40. then
  41. .B "\-v \-i"
  42. is assumed when the standard input is a terminal;
  43. otherwise,
  44. .B "\-"
  45. is assumed.
  46. .LP
  47. In interactive mode,
  48. .B lua
  49. prompts the user,
  50. reads lines from the standard input,
  51. and executes them as they are read.
  52. If the line contains an expression or list of expressions,
  53. then the line is evaluated and the results are printed.
  54. If a line does not contain a complete statement,
  55. then a secondary prompt is displayed and
  56. lines are read until a complete statement is formed or
  57. a syntax error is found.
  58. .LP
  59. At the very start,
  60. before even handling the command line,
  61. .B lua
  62. checks the contents of the environment variables
  63. .B LUA_INIT_5_3
  64. or
  65. .BR LUA_INIT ,
  66. in that order.
  67. If the contents is of the form
  68. .RI '@ filename ',
  69. then
  70. .I filename
  71. is executed.
  72. Otherwise, the string is assumed to be a Lua statement and is executed.
  73. .SH OPTIONS
  74. .TP
  75. .BI \-e " stat"
  76. execute statement
  77. .IR stat .
  78. .TP
  79. .B \-i
  80. enter interactive mode after executing
  81. .IR script .
  82. .TP
  83. .BI \-l " name"
  84. execute the equivalent of
  85. .IB name =require(' name ')
  86. before executing
  87. .IR script .
  88. .TP
  89. .B \-v
  90. show version information.
  91. .TP
  92. .B \-E
  93. ignore environment variables.
  94. .TP
  95. .B \-\-
  96. stop handling options.
  97. .TP
  98. .B \-
  99. stop handling options and execute the standard input as a file.
  100. .SH "SEE ALSO"
  101. .BR luac (1)
  102. .br
  103. The documentation at lua.org,
  104. especially section 7 of the reference manual.
  105. .SH DIAGNOSTICS
  106. Error messages should be self explanatory.
  107. .SH AUTHORS
  108. R. Ierusalimschy,
  109. L. H. de Figueiredo,
  110. W. Celes
  111. .\" EOF