1 | .\" $Id: lua.man,v 1.13 2011/11/16 17:16:53 lhf Exp $ |
---|
2 | .TH LUA 1 "$Date: 2011/11/16 17:16:53 $" |
---|
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 a line does not contain a complete statement, |
---|
54 | then a secondary prompt is displayed and |
---|
55 | lines are read until a complete statement is formed or |
---|
56 | a syntax error is found. |
---|
57 | If a line starts with |
---|
58 | .BR '=' , |
---|
59 | then |
---|
60 | .B lua |
---|
61 | evaluates and displays |
---|
62 | the values of the expressions in the remainder of the line. |
---|
63 | .LP |
---|
64 | At the very start, |
---|
65 | before even handling the command line, |
---|
66 | .B lua |
---|
67 | checks the contents of the environment variables |
---|
68 | .B LUA_INIT_5_2 |
---|
69 | or |
---|
70 | .BR LUA_INIT , |
---|
71 | in that order. |
---|
72 | If the contents is of the form |
---|
73 | .RI '@ filename ', |
---|
74 | then |
---|
75 | .I filename |
---|
76 | is executed. |
---|
77 | Otherwise, the string is assumed to be a Lua statement and is executed. |
---|
78 | .SH OPTIONS |
---|
79 | .TP |
---|
80 | .BI \-e " stat" |
---|
81 | execute statement |
---|
82 | .IR stat . |
---|
83 | .TP |
---|
84 | .B \-i |
---|
85 | enter interactive mode after executing |
---|
86 | .IR script . |
---|
87 | .TP |
---|
88 | .BI \-l " name" |
---|
89 | execute the equivalent of |
---|
90 | .IB name =require(' name ') |
---|
91 | before executing |
---|
92 | .IR script . |
---|
93 | .TP |
---|
94 | .B \-v |
---|
95 | show version information. |
---|
96 | .TP |
---|
97 | .B \-E |
---|
98 | ignore environment variables. |
---|
99 | .TP |
---|
100 | .B \-\- |
---|
101 | stop handling options. |
---|
102 | .TP |
---|
103 | .B \- |
---|
104 | stop handling options and execute the standard input as a file. |
---|
105 | .SH "SEE ALSO" |
---|
106 | .BR luac (1) |
---|
107 | .br |
---|
108 | The documentation at lua.org, |
---|
109 | especially section 7 of the reference manual. |
---|
110 | .SH DIAGNOSTICS |
---|
111 | Error messages should be self explanatory. |
---|
112 | .SH AUTHORS |
---|
113 | R. Ierusalimschy, |
---|
114 | L. H. de Figueiredo, |
---|
115 | W. Celes |
---|
116 | .\" EOF |
---|