LUA5.2(1)

πŸ“¦
version 5.2.4 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ LUA5.2(1) β€” the lua girlies' guide ✨

okay bestie, you're looking at the LUA5.2(1) page from the General Commands Manual, and honestly? it's giving iconic. sit down, grab a boba, let's get into it πŸ’…


🌸 NAME 🌸

lua β€” the Lua interpreter. that's her. that's the whole vibe. she interprets. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

lua [ options ] [ script [ args ] ]

like... that's it. that's the whole entrance. she's lowkey simple and that's the point πŸŽ€


πŸ’œ DESCRIPTION πŸ’œ

so lua is the standalone Lua interpreter, and no cap, she's the main character. she loads and executes Lua programs β€” either in textual source form or in precompiled binary form. (and where do those precompiled binaries come from, you ask? luac, the Lua compiler. she's the one handing out the glow-ups πŸ’…) and get this β€” lua can be used as a batch interpreter and interactively. versatile queen πŸ‘‘

the given options get handled in order, and then the Lua program in the file script is loaded and executed. the given args are available to script as strings in a global table named arg. 🫢

and here's the little detail that matters: if you give her no options and no arguments, then -v -i is assumed when the standard input is a terminal; otherwise, - is assumed. she knows what you want before you say it, fr fr 😭

πŸ’‘ in interactive mode, lua prompts the user, reads lines from the standard input, and executes them as they are read. if a line doesn't contain a complete statement, a secondary prompt is displayed and lines keep being read until a complete statement is formed or a syntax error is found. and if a line starts with =, then lua evaluates and displays the values of the expressions in the remainder of the line. the way that = is just ✨ free real estate ✨

also, before literally anything else β€” before she even touches the command line β€” lua checks the contents of the environment variables LUA_INIT_5_2 or LUA_INIT, in that order πŸ‘‘ and if the contents is of the form @filename, then filename is executed. otherwise, the string is assumed to be a Lua statement and is executed. she's thorough. she's prepared. she ate πŸ“


πŸŽ€ OPTIONS πŸŽ€

  • -e stat β€” execute statement stat. just... run it. right now. periodt πŸ’…
  • -i β€” enter interactive mode after executing script. she does the script thing and then she hangs out with you 🌈
  • -l name β€” execute the equivalent of name=require('name') before executing script. it's the pre-game ritual bestie ✨
  • -v β€” show version information. say hi to her name and number 😌
  • -E β€” ignore environment variables. she's putting her phone on do not disturb πŸ’€
  • -- β€” stop handling options. that's a wrap on the options section 🎬
  • - β€” stop handling options and execute the standard input as a file. she's done taking notes, she's reading straight from the source 🧚

🌟 SEE ALSO 🌟

  • luac(1)
  • The documentation at lua.org, especially section 7 of the reference manual. go read it, iykyk πŸ“š

πŸ’€ DIAGNOSTICS πŸ’€

Error messages should be self explanatory. like she literally tells you what went wrong. read the message babe πŸ™ˆ


πŸ‘‘ AUTHORS πŸ‘‘

R. Ierusalimschy, L. H. de Figueiredo, W. Celes β€” the founding mothers/fathers of the whole thing, we stan 🌸


and that's the tea, bestie πŸ’– this lil love letter was last touched on $Date: 2011/11/16 17:16:53 $ and it lives under the name LUA5.2(1) in your friendly neighbourhood General Commands Manual. go write something cute in Lua. you got this. πŸ¦‹βœ¨
πŸ“¦ where this page comes from