1 .\" $NetBSD: lua.1,v 1.1.1.2 2012/03/15 00:08:15 alnsn Exp $
3 .\" $Id: lua.1,v 1.1.1.2 2012/03/15 00:08:15 alnsn Exp $
4 .TH LUA 1 "$Date: 2012/03/15 00:08:15 $"
20 is the stand-alone Lua interpreter.
21 It loads and executes Lua programs,
22 either in textual source form or
23 in precompiled binary form.
24 (Precompiled binaries are output by
28 can be used as a batch interpreter and also interactively.
34 the Lua program in file
36 is loaded and executed.
41 as strings in a global table named
43 If these arguments contain spaces or other characters special to the shell,
44 then they should be quoted
45 (but note that the quotes will be removed by the shell).
49 which contains the string
51 The index of the last argument is stored in
53 The arguments given in the command line before
55 including the name of the interpreter,
56 are available in negative indices in
60 before even handling the command line,
62 executes the contents of the environment variable
72 Otherwise, the string is assumed to be a Lua statement and is executed.
76 and are described below.
79 to signal the end of options.
81 If no arguments are given,
84 is assumed when the standard input is a terminal;
92 reads lines from the standard input,
93 and executes them as they are read.
94 If a line does not contain a complete statement,
95 then a secondary prompt is displayed and
96 lines are read until a complete statement is formed or
97 a syntax error is found.
98 So, one way to interrupt the reading of an incomplete statement is
99 to force a syntax error:
102 in the middle of a statement is a sure way of forcing a syntax error
103 (except inside multiline strings and comments; these must be closed explicitly).
104 If a line starts with
108 displays the values of all the expressions in the remainder of the
109 line. The expressions must be separated by commas.
110 The primary prompt is the value of the global variable
112 if this value is a string;
113 otherwise, the default prompt is used.
114 Similarly, the secondary prompt is the value of the global variable
117 to change the prompts,
118 set the corresponding variable to a string of your choice.
119 You can do that after calling the interpreter
120 or on the command line
121 (but in this case you have to be careful with quotes
122 if the prompt string contains a space; otherwise you may confuse the shell.)
123 The default prompts are "> " and ">> ".
127 load and execute the standard input as a file,
130 even when the standard input is a terminal.
137 if it contains spaces, quotes,
138 or other characters special to the shell.
141 enter interactive mode after
147 .BI require(' name ')
150 Typically used to load libraries.
153 show version information.
159 Error messages should be self explanatory.