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 in‐
21       put 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 mod require library mod into global mod.
43
44       -l g=mod
45              require library mod into global g.
46
47       -v     show version information.
48
49       -E     ignore environment variables.
50
51       -W     turn warnings on.
52
53       --     stop handling options.
54
55       -      stop handling options and execute the standard input as a file.
56

ENVIRONMENT VARIABLES

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

EXIT STATUS

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

DIAGNOSTICS

80       Error messages should be self explanatory.
81

SEE ALSO

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

AUTHORS

88       R. Ierusalimschy, L. H. de Figueiredo, W. Celes
89
90
91
92                         $Date: 2022/09/23 09:06:36 $                   LUA(1)
Impressum