lua.1 2.1 KB

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