Blame | Last modification | View Log | Download
.\" $Id: lua.man,v 1.14 2020/05/21 19:31:21 lhf Exp $.TH LUA 1 "$Date: 2020/05/21 19:31:21 $".SH NAMElua \- Lua interpreter.SH SYNOPSIS.B lua[.I options][.I script[.I args]].SH DESCRIPTION.B luais the standalone Lua interpreter.It loads and executes Lua programs,either in textual source form orin precompiled binary form.(Precompiled binaries are output by.BR luac ,the Lua compiler.).B luacan be used as a batch interpreter and also interactively..LPAfter handling the.IR options ,the Lua program in file.I scriptis loaded and executed.The.I argsare available to.I scriptas strings in a global table named.B argand also as arguments to its main function.When called without arguments,.B luabehaves as.B "lua \-v \-i"if the standard input is a terminal,and as.B "lua \-"otherwise..LPIn interactive mode,.B luaprompts the user,reads lines from the standard input,and executes them as they are read.If the line contains an expression,then the line is evaluated and the result is printed.If a line does not contain a complete statement,then a secondary prompt is displayed andlines are read until a complete statement is formed ora syntax error is found..LPBefore handling command line options and scripts,.B luachecks the contents of the environment variables.B LUA_INIT_5_4and.BR LUA_INIT ,in that order.If the contents are of the form.RI '@ filename ',then.I filenameis executed.Otherwise, the contents are assumed to be a Lua statement and is executed.When.B LUA_INIT_5_4is defined,.B LUA_INITis ignored..SH OPTIONS.TP.BI \-e " stat"execute statement.IR stat ..TP.B \-ienter interactive mode after executing.IR script ..TP.BI \-l " name"require library.I nameinto global.IR name ..TP.B \-vshow version information..TP.B \-Eignore environment variables..TP.B \-Wturn warnings on..TP.B \-\-stop handling options..TP.B \-stop handling options and execute the standard input as a file..SH ENVIRONMENT VARIABLESThe following environment variables affect the execution of.BR lua .When defined,the version-specific variants take priorityand the version-neutral variants are ignored..TP.B LUA_INIT, LUA_INIT_5_4Code to be executed before command line options and scripts..TP.B LUA_PATH, LUA_PATH_5_4Initial value of package.cpath,the path used by require to search for Lua loaders..TP.B LUA_CPATH, LUA_CPATH_5_4Initial value of package.cpath,the path used by require to search for C loaders..SH EXIT STATUSIf a script calls os.exit,then.B luaexits with the given exit status.Otherwise,.B luaexitswith EXIT_SUCCESS (0 on POSIX systems) if there were no errorsandwith EXIT_FAILURE (1 on POSIX systems) if there were errors.Errors raised in interactive mode do not cause exits..SH DIAGNOSTICSError messages should be self explanatory..SH "SEE ALSO".BR luac (1).brThe documentation at lua.org,especially section 7 of the reference manual..SH AUTHORSR. Ierusalimschy,L. H. de Figueiredo,W. Celes.\" EOF