LUA5.5(1)
π LUA5.5 β bestie's guide to the lua interpreter π
okay so. this is the manual page for lua, from the General Commands Manual section (section 1, iykyk). it's giving the main character of the Lua world and we're gonna walk through it together, no cap. β¨
πΈ NAME πΈ
lua β literally the Lua interpreter. that's her. that's the whole vibe.
π SYNOPSIS π
lua [ options ] [ script [ args ] ]
so you got your options, you got your script, you got your args. slay.
β¨ DESCRIPTION β¨
lua is the standalone Lua interpreter β the one that just runs stuff, no compiler drama. it loads and executes Lua programs, and it's flexible about it: either in textual source form or in precompiled binary form. (btw those precompiled binaries are output by luac, the Lua compiler β her slightly more serious cousin π
.)
and the way lua can serve cunt in two modes?? it works as a batch interpreter AND it can be interactive. versatility queen. π
After handling the options, the Lua program in file script is loaded and executed. the args are available to script as strings in a global table named arg, and also as arguments to its main function. so they show up in two places, iconic behavior fr fr.
When called without arguments, lua behaves as lua -v -i if the standard input is a terminal, and as lua - otherwise. (so like, it checks the vibe of your stdin first π«Ά)
π¦ interactive mode π¦
In interactive mode, lua prompts 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. (little calculator moment, we love a REPL β¨)
If a line does not contain a complete statement, then a secondary prompt is displayed and lines are read until a complete statement is formed or a syntax error is found. so she'll wait for you to finish your thought. patient bestie energy.
π§ environment setup before anything else π§
Before handling command line options and scripts, lua checks the contents of the environment variables LUA_INIT_5_5 and LUA_INIT, in that order.
- If the contents are of the form
'@filename', then filename is executed. - Otherwise, the contents are assumed to be a Lua statement and is executed.
β οΈ WhenLUA_INIT_5_5is defined,LUA_INITis ignored. no overlap. she said one at a time please. π
π OPTIONS π
here's the whole lineup, every single one, bestie. no skips.
-e statβ execute statement stat. just run the thing right there.-iβ enter interactive mode after executing script. run first, chat after.-l modβ require library mod into global mod. so the module lands in a global with the same name.-l g=modβ require library mod into global g. you pick the global name this time, custom queen.-vβ show version information. a lil flex.-Eβ ignore environment variables. β¨ no env, just vibes β¨-Wβ turn warnings on. she's gonna tell you things now.--β stop handling options. nothing after this gets read as an option.-β stop handling options and execute the standard input as a file.
π ENVIRONMENT VARIABLES π
The following environment variables affect the execution of lua. When defined, the version-specific variants take priority and the version-neutral variants are ignored. (so the _5_5 ones win, always π)
LUA_INIT,LUA_INIT_5_5β code to be executed before command line options and scripts. it goes first, before literally everything.LUA_PATH,LUA_PATH_5_5β initial value ofpackage.path, the path used byrequireto search for Lua loaders. this is where she goes looking for your Lua modules πLUA_CPATH,LUA_CPATH_5_5β initial value ofpackage.cpath, the path used byrequireto search for C loaders. and this is the C-module hunting ground π₯
π EXIT STATUS π
If a script calls os.exit, then lua exits with the given exit status. she respects your decision, periodt.
Otherwise:
luaexits withEXIT_SUCCESS(0on POSIX systems) if there were no errors β- and with
EXIT_FAILURE(1on POSIX systems) if there were errors π
πΈ but listen: Errors raised in interactive mode do not cause exits. she just moves on. no hard feelings. it's giving resilience.
π DIAGNOSTICS π
Error messages should be self explanatory. she's not cryptic, she's direct. π
π«Ά SEE ALSO π«Ά
luac(1)β the compiler bestie- The documentation at
lua.org, especially section 7 of the reference manual. go read it, it's a whole meal. π
π AUTHORS π
R. Ierusalimschy, L. H. de Figueiredo, W. Celes β the icons who built her. respect. π«‘
okay that's the whole page, mwah. this version is dated $Date: 2024/03/18 06:57:32 $ and it lives in the General Commands Manual as LUA5.5(1). go run something cute. πβ¨π
π¦ where this page comes from
- ubuntu resolute: lua5.5 5.5.0-3 Β· MIT
- ubuntu resolute: lua5.5 5.5.0-3ubuntu0.1 Β· MIT
- ubuntu stonking: lua5.5 5.5.1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms