luajit(1)

✨ luajit β€” the manual page, but make it cute ✨

okay bestie, sit down, hydrate, and let me tell you about luajit(1) πŸ’… this is the manual page for LuaJIT, straight from the LuaJIT documentation, and by the end of this you're gonna be running circles around everyone. no cap.


🌸 NAME 🌸

luajit β€” the Just-In-Time Compiler for the Lua Language. yes, that's its whole government name. it compiles. it's just in time. it's iconic. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

luajit [options]... [script [args]...]

that's the whole vibe. options first, then optionally a script, then optionally that script's args. that's it. that's the shape of it. ✨


🌈 WEB SITE 🌈

https://luajit.org

go there. bookmark it. tell your friends. it's giving resource. 🫢


πŸ’– DESCRIPTION πŸ’–

so this is the command-line program you use to run Lua programs with LuaJIT. that's the whole job description.

LuaJIT is a just-in-time (JIT) compiler for the Lua language. the virtual machine (VM) is built on a fast interpreter combined with a trace compiler, and the way that combo just significantly improves the performance of Lua programs?? obsessed. πŸ”₯

and here's the part that makes it lowkey a big deal: LuaJIT is API- and ABI-compatible with the VM of the standard Lua 5.1 interpreter. so when you're embedding the VM into an application, the built library can be used as a drop-in replacement. no rewrites, no drama, just swap and slay. πŸ’…


πŸŽ€ OPTIONS πŸŽ€

one bullet per flag, bestie, we do not skip. every single one is here.

  • -e chunk β€” run the given chunk of Lua code. instant script, no file needed. ⚑
  • -l library β€” load the named library, literally exactly like require("library"). same energy, different spelling. πŸ“
  • -b ... β€” save or list bytecode. run it with no arguments and it'll hand you help on the options. it's helpful like that. πŸ™ˆ
  • -j command β€” perform a LuaJIT control command. (psst: an optional space after -j is allowed, so -j command and -jcommand both work.) πŸ‘‘
  • -O[opt] β€” control LuaJIT optimizations. the opt part is optional, hence the brackets. 🧚
  • -i β€” run in interactive mode. chat with your interpreter. πŸ’¬
  • -v β€” show the LuaJIT version. vibe check the build. ⭐
  • -E β€” ignore environment variables. boundaries. set them. 🚫
  • -- β€” stop processing options. everything after this is not a flag, periodt. βœ‹
  • - β€” read the script from stdin instead. pipe it in, live your life. 🌊

okay so here's what happens next, and it matters: after all options are processed, the given script is run, and the arguments are passed in the global arg table. 🌸

and interactive mode? it's only entered if there's no script and no -e option given. that's the only door in. πŸšͺ

interactive mode can be left with EOF (Ctrl-Z). that's your exit, bestie. don't get trapped in there. 😭

✨ EXAMPLES ✨

okay now the fun part, let's actually do stuff. πŸ’…

1.

luajit hello.lua world

prints "Hello world", assuming hello.lua contains:

print("Hello", arg[1])

look at arg[1] doing its little job. we love a global table moment. πŸŽ€

2.

luajit -e "local x=0; for i=1,1e9 do x=x+i end; print(x)"

calculates the sum of the numbers from 1 to 1000000000. a billion iterations. and it finishes in a reasonable amount of time, too. 😌 that's the JIT working its magic, no cap. πŸ”₯

3.

luajit -jv -e "for i=1,10 do for j=1,10 do for k=1,100 do end end end"

runs some nested loops and shows the resulting traces. trace compiler said let me cook. πŸ‘‘


LuaJIT is Copyright Β© 2005-2026 Mike Pall.

LuaJIT is open source software, released under the MIT license. free, open, generous. we stan. πŸ’œ


🌟 SEE ALSO 🌟

and also:


and that's the whole page, bestie. this was luajit(1) from the LuaJIT documentation β€” and since this page has no date stamped on it, just take my word for it: it's current, it's cute, and it's yours. πŸ’– go compile something. mwah. πŸ’…βœ¨