luajit2(1)

πŸ“¦ version 2.1.20250529, in opensuse-leap 16.0

πŸ’… NAME

okay so bestie, meet luajit2 β€” it's OpenResty's maintained branch of LuaJIT. that's the whole vibe. ✨


πŸŽ€ SYNOPSIS

luajit2 [options]... [script [args]...]

πŸ¦‹ WEB SITE

the mothership, fr: https://github.com/openresty/luajit2 🌈


πŸ’– DESCRIPTION

okay so real talk: this right here is the command-line program that runs your Lua programs with LuaJIT2. 🫢

LuaJIT2 is a just-in-time (JIT) compiler for the Lua language β€” like, it watches what your code is doing and then speeds it up on the fly. iconic behavior honestly. the virtual machine (VM) is based on a fast interpreter combined with a trace compiler. it can significantly improve the performance of Lua programs. not me being obsessed with a bytecode compiler 😭

and here's the slay part: LuaJIT2 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. literally just swap it in. no cap. πŸ‘‘


✨ OPTIONS ✨

here's the full menu, bestie β€” every single one, no skips:

  • -e chunk β€” run the given chunk of Lua code. one-liner core πŸ’…
  • -l library β€” load the named library, just like require("library"). same energy, shorter typing. πŸ“
  • -b ... β€” save or list bytecode. run it with no arguments to get help on options β€” it'll tell you what it wants. πŸŽ€
  • -j command β€” perform a LuaJIT2 control command (and yes, an optional space after -j is fine). πŸ’œ
  • -O[opt] β€” control LuaJIT2 optimizations. tune it, bestie. πŸ”₯
  • -i β€” run in interactive mode. the REPL era begins. ✨
  • -v β€” show LuaJIT2 version. say hi. πŸ‘‹
  • -E β€” ignore environment variables. bye felicia 🫢
  • -- β€” stop processing options. everything after is not an option, periodt. πŸ›‘
  • - β€” read script from stdin instead. 🌸

after all options are processed, the given script is run. the arguments are passed in the global arg table β€” that's where they live, iykyk. 🌈

interactive mode is only entered if no script and no -e option is given. and you can leave interactive mode with EOF (Ctrl+Z). πŸ’€

🌟 EXAMPLES

luajit2 hello.lua world

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

print("Hello", arg[1])

luajit2 -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. and finishes in a reasonable amount of time, too. like?? a billion iterations?? main character energy tbh. πŸ”₯πŸ‘‘

luajit2 -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. vibe check: passed. πŸ¦‹


LuaJIT2 is Copyright Β© 2005-2025 Mike Pall.

LuaJIT2 is open source software, released under the MIT license. ate and left no crumbs. πŸ’–


🌸 SEE ALSO

more details in the provided HTML docs or at: https://github.com/openresty/luajit2

more about the Lua language can be found at: https://lua.org/docs.html ✨

lua(1) β€” the classic. the blueprint. πŸŽ€


okay that's the whole page bestie!! you're officially a luajit2(1) girlie now 🫢 β€” this was the luajit2(1) page from the LuaJIT2 documentation, brought to you with love, bytecode, and absolutely zero chill. mwah πŸ’…βœ¨

πŸ“¦ where this page comes from