-
Notifications
You must be signed in to change notification settings - Fork 16
/
luap.1
168 lines (160 loc) · 4.64 KB
/
luap.1
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
.TH LUAP "1" "27 Oct 2024" "luap 0.9" "User Commands"
.SH NAME
luap \- Lua prompt with pretty-printing and autocompletion
.SH SYNOPSIS
.B luap
[
.BI \-e "\| STMT\^"
]
[
.BI \-l "\| NAME\^"
]
[
.B \-p
]
[
.B \-v
]
[
.B \-i
]
[
.B \-h
]
[
.B "<SCRIPT>"
] ...
.SH DESCRIPTION
.PP
.B luaprompt
is both an interactive Lua prompt that can be used instead
of the official interpreter, as well as a module that provides a Lua
command prompt that can be embedded in a host application. As a
standalone interpreter it provides many conveniences that are missing
from the official Lua interpreter. As an embedded prompt, it's meant
for applications that use Lua as a configuration or interface language
and can therefore benefit from an interactive prompt for debugging or
regular use.
.LP
.B luaprompt
features:
.RS 2
.IP \(bu 2
Readline-based input with history and completion: In particular all
keywords, global variables and table accesses (with string or
integer keys) can be completed in addition to Readline's standard
file completion. Module names are also completed, for modules
installed in the standard directories, and completed modules can
optionally be loaded.
.IP \(bu
Persistent command history (retained across sessions), as well as
recording of command results for future reference.
.IP \(bu
Proper value pretty-printing for interactive use: When an expression
is entered at the prompt, all returned values are printed
(prepending with an equal sign is not required). Values are printed
in a descriptive way that tries to be as readable as possible. The
formatting tries to mimic Lua code (this is done to minimize
ambiguities and no guarantees are made that it is valid code).
Additionally, each value is stored in a table for future reference.
.IP \(bu
Color highlighting of error messages and variable printouts.
.RE
.LP
.B luap
tries to mimic the standard Lua interpreter as much as possible
(currently only the -E flag is not supported) while providing the
extra set of features described above. All option arguments start
with a single hyphen, followed by a letter. Multiple consecutive
options can be specified by their respective letters following a
single hyphen. Anything that does not follow this format is
interpreted, either as a script file, which is to be executed (if it
is the first non-option argument), or as an argument that is to be
passed to the script (for subsequent non-option arguments). A single
hyphen is interpreted as a request to execute the standard input.
If no options are passed,
.B luap
enters interactive mode, as if the
.I \-i
option had been specified.
A file with custom configuration, or startup actions can be placed
either at \fI~/.luaprc.lua\fP, or alternatively at
\fI~/.config/luaprc.lua\fP. The first of these to be found is loaded
and executed at startup.
.SH OPTIONS
.PP
.B luap
accepts the following options:
.PP
.PD 0
.TP 10
.BI \-e "\| STMT\^"
Execute string
.IR STMT .
.TP
.BI \-l "\| NAME\^"
Require library
.IR NAME .
.TP
.B \-p
Force plain, uncolored output.
.TP
.B \-v
Print version information.
.TP
.B \-i
Enter interactive mode.
.TP
.B \-h
Show this help message and exit.
.TP
.B \-\-
Stop processing arguments. The rest of the line is interpreted a
script file to execute, optionally followed by arguments that should
be passed to the script.
.PD
.PP
When
.B luap
is used with LuaJIT, the following additional arguments are also understood:
.PP
.PD 0
.TP 10
.BI \-j "\| CMD\^"
Perform LuaJIT control command.
.TP
.BI \-O "\| OPT\^"
Control LuaJIT optimizations.
.PD
.SH CONFIGURATION
.BR luaprompt "'s"
and subsequently
.BR luap "'s"
functionality, can be customized at build-time. See the
documentation accompanying the source code for more details.
Additionally, you can customize
.BR luap "'s"
command line interface, as it is based on
.BR "GNU Readline" .
This includes the ability to change behavior, such as how completion is performed, define additional keybindings or redefine existing ones, define custom macros and other possibilities. It is therefore highly recommended to consult
.BR readline (3)
for more information.
Note that
.B luaprompt
sets its application name, so that you can have custom Readline
configuration, that will be effective for
.B luaprompt
only (thus not affecting every other Readline-enabled application on
your system). You can achieve that using
.BR $if " ... " $endif
conditional constructs within Readline's initialization file. Again, see
.BR readline (3)
for more information.
.SH "SEE ALSO"
.BR lua (1),
.BR luac (1),
.BR readline (3)
.SH AUTHOR
Dimitris Papavasileiou ([email protected]), Boris Nagaev
.SH "REPORTING BUGS"
Please report bugs at the luaprompt home page at https://github.com/dpapavas/luaprompt.