1LUA(1)                      General Commands Manual                     LUA(1)
2
3
4

NAME

6       lua - Lua interpreter
7

SYNOPSIS

9       lua [ options ] [ script [ args ] ]
10

DESCRIPTION

12       lua  is the standalone Lua interpreter.  It loads and executes Lua pro‐
13       grams, either in textual source form or  in  precompiled  binary  form.
14       (Precompiled  binaries  are output by luac, the Lua compiler.)  lua can
15       be used as a batch interpreter and also interactively.
16
17       After handling the options, the Lua program in file  script  is  loaded
18       and  executed.  The args are available to script as strings in a global
19       table named arg and also as  arguments  to  its  main  function.   When
20       called  without  arguments,  lua  behaves  as lua -v -i if the standard
21       input is a terminal, and as lua - otherwise.
22
23       In interactive mode, lua prompts the user, reads lines from  the  stan‐
24       dard  input,  and executes them as they are read.  If the line contains
25       an expression, then the line is evaluated and the  result  is  printed.
26       If  a  line  does  not  contain  a complete statement, then a secondary
27       prompt is displayed and lines are read until a  complete  statement  is
28       formed or a syntax error is found.
29
30       Before  handling  command line options and scripts, lua checks the con‐
31       tents of the environment variables LUA_INIT_5_4 and LUA_INIT,  in  that
32       order.   If  the contents are of the form '@filename', then filename is
33       executed.  Otherwise, the contents are assumed to be  a  Lua  statement
34       and is executed.  When LUA_INIT_5_4 is defined, LUA_INIT is ignored.
35

OPTIONS

37       -e stat
38              execute statement stat.
39
40       -i     enter interactive mode after executing script.
41
42       -l name
43              require library name into global name.
44
45       -v     show version information.
46
47       -E     ignore environment variables.
48
49       -W     turn warnings on.
50
51       --     stop handling options.
52
53       -      stop handling options and execute the standard input as a file.
54

ENVIRONMENT VARIABLES

56       The  following environment variables affect the execution of lua.  When
57       defined, the version-specific variants take priority and  the  version-
58       neutral variants are ignored.
59
60       LUA_INIT, LUA_INIT_5_4
61              Code to be executed before command line options and scripts.
62
63       LUA_PATH, LUA_PATH_5_4
64              Initial  value  of  package.cpath,  the  path used by require to
65              search for Lua loaders.
66
67       LUA_CPATH, LUA_CPATH_5_4
68              Initial value of package.cpath, the  path  used  by  require  to
69              search for C loaders.
70

EXIT STATUS

72       If  a  script calls os.exit, then lua exits with the given exit status.
73       Otherwise, lua exits with EXIT_SUCCESS (0 on POSIX  systems)  if  there
74       were no errors and with EXIT_FAILURE (1 on POSIX systems) if there were
75       errors.  Errors raised in interactive mode do not cause exits.
76

DIAGNOSTICS

78       Error messages should be self explanatory.
79

SEE ALSO

81       luac(1)
82       The documentation at lua.org, especially section  7  of  the  reference
83       manual.
84

AUTHORS

86       R. Ierusalimschy, L. H. de Figueiredo, W. Celes
87
88
89
90                         $Date: 2020/05/21 19:31:21 $                   LUA(1)
Impressum