1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
.\" lua.man,v 1.3 2000/09/04 21:41:28 lhf Exp
.TH LUA 1 "2000/09/04 21:41:28"
.SH NAME
lua \- Lua interpreter
.SH SYNOPSIS
.B lua
[
.I arguments
]
.SH DESCRIPTION
.B lua
is the stand-alone Lua interpreter.
It loads and executes Lua programs,
either in textual source form or
in precompiled binary form,
as output by
.BR luac ,
the Lua compiler.
.B lua
can be used as a batch interpreter and also interactively.
.LP
The
.I arguments
can be options, assignments, or filenames,
and are processed in order,
from left to right.
.LP
Options start with
.B \-
and are described below.
.LP
An assignment is an argument of the form
.BR a=b ,
which assigns the string
.RB ` b '
to the global variable
.BR a .
Note that no quotes are needed around the string if it does not contain spaces
or other characters special to the shell.
This is for convenience only.
(In general,
you should be careful when using quotes and spaces on the command line
because they are usually handled by the shell.)
.LP
If the argument is neither an option nor an assignment,
then it is assumed to be a filename,
which is then loaded and executed.
.LP
If no arguments are given,
then
.B "\-v \-i"
is assumed when the standard input is a terminal;
otherwise,
.B \-
is assumed.
.SH OPTIONS
.TP
.B \-
load the standard input as a file,
that is,
not interactively,
even when the standard input is a terminal.
.TP
.B \-c
close Lua before exiting.
.TP
.BI \-e " stat"
execute statement
.IR stat .
You will need to quote
.I stat
if it contains spaces or quotes.
.TP
.BI \-f " file"
collect all remaining arguments as strings into a global table named
.B arg
and then execute
.IR file .
The arguments in
.B arg
start at 0,
which contains the string
.RI ` file '.
The index of the last argument is stored in
.BR "arg.n" .
.TP
.B \-i
enter interactive mode,
displaying a prompt.
In this mode,
.B lua
reads lines from the standard input and executes them as they are read.
Each line must contain a complete statement.
To span a statement across several lines, end each line with a backslash
.BR `\e' .
The prompt shown is the value of the global variable
.BR _PROMPT ,
if this value is a string.
So,
to change the prompt,
set
.B _PROMPT
to a string of your choice.
You can do that after calling the interpreter
or on the command line with
.BR "_PROMPT=\'lua: \'" ,
for example.
(Note the need for quotes, because the string contains a space.)
The default prompt is ``> ''.
.TP
.B \-q
enter interactive mode,
but without displaying a prompt.
.TP
.BI \-s n
set the stack size to
.IB n .
If present,
this must be the first option.
Note that
.I n
is in the same argument as
.BR -s .
For example,
to specify a stack size of 2000,
use
.BR -s2000 .
.TP
.B \-v
print version information.
.SH "SEE ALSO"
.BR luac (1)
.br
http://www.tecgraf.puc-rio.br/lua/
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
R. Ierusalimschy,
L. H. de Figueiredo,
and
W. Celes
(lua@tecgraf.puc-rio.br)
.\" EOF
|