LUA(1)

NAME
lua - Lua interpreter

SYNOPSIS
lua [ arguments ]

DESCRIPTION
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 luac, the Lua compiler. lua can be used as a batch interpreter and also interactively.

The arguments can be options, assignments, or filenames, and are processed in order, from left to right.

Options start with - and are described below.

An assignment is an argument of the form a=b, which assigns the string `b' to the global variable 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.)

If the argument is neither an option nor an assignment, then it is assumed to be a filename, which is then loaded and executed.

If no arguments are given, then -v -i is assumed when the standard input is a terminal; otherwise, - is assumed.

OPTIONS

-   load the standard input as a file, that is, not interactively, even when the standard input is a terminal.

-c  close Lua before exiting (that is, after all arguments have been processed).

-e stat
    execute statement stat. You need to quote stat if it contains spaces or quotes.

-f file
    collect all remaining arguments as strings into a global table named arg and then execute file. The arguments in arg start at 0, which contains the string `file'. The index of the last argument is stored in arg.n.

-i  enter interactive mode, displaying a prompt. In this mode, 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 `\'. The prompt shown is the value of the global variable _PROMPT, if this value is a string. So, to change the prompt, set _PROMPT to a string of your choice. You can do that after calling the interpreter or on the command line with _PROMPT='lua: ', for example. (Note the need for quotes, because the string contains a space.) The default prompt is ``> ''.

-q  enter interactive mode, but without displaying a prompt.

-sn set the stack size to n. If present, this must be the first option. Note that n must be in the same argument as -s. For example, to specify a stack size of 2000, use -s2000 (not -s 2000).

-v  print version information.

SEE ALSO
luac(1)
http://www.lua.org/

DIAGNOSTICS
Error messages should be self explanatory.

AUTHORS
R. Ierusalimschy, L. H. de Figueiredo, and W. Celes (lua@tecgraf.puc-rio.br)