-LuaJIT has only a single stand-alone executable, called luajit. -It can be used to run simple Lua statements or whole Lua applications -from the command line. It has an interactive mode, too. -
--Note: The optimizer is not activated by default because it resides -in an external module -(see Installing LuaJIT). -It's recommended to always use the optimizer, i.e.: luajit -O -
- -Command Line Options
--The luajit stand-alone executable is just a slightly modified -version of the regular lua stand-alone executable. -It supports the same basic options, too. Please have a look at the -Manual Page -for the regular lua stand-alone executable. -
--Two additional options control LuaJIT behaviour: -
- --j cmd[=value]
--This option performs a LuaJIT control command. LuaJIT has a small -but extensible set of control commands. It's easy to add your own. -
--The command is first searched for in the jit.* library. -If no matching function is found, a module named jit.<cmd> -is loaded. The module table must provide a start() function. -
--For the -j cmd form the function is called without an argument. -Otherwise the value is passed as the first argument (a string). -
--Here are the built-in LuaJIT control commands: -
--
-
- -j on — Turns the JIT engine on (default). -
- -j off — Turns the JIT engine off. -
- -j debug[=level] — Set debug level. See -jit.debug(). -
-The following control commands are loaded from add-on modules: -
--
-
- -j trace[=file] — Trace the progress of the JIT compiler. -
- -j dumphints[=file] — Dump bytecode + hints before compilation. -
- -j dump[=file] — Dump machine code after compilation. -
-O[level]
--This option loads and runs the optimizer module jit.opt. -The optimizer generates hints for the compiler backend to improve -the performance of the compiled code. The optimizer slows down -compilation slightly, but the end result should make up for it -in almost every case. -
--The -O form sets the default optimizer level, which is -currently 2 (this may change in future versions -of LuaJIT). -
--The -Olevel form explicitly sets the optimizer level: -
--
-
- -O0 — disable the optimizer but leave it attached. -
- -O1 — perform standard optimizations (like hints for table lookups). -
- -O2 — like -O1 but also loads jit.opt_inline to enable result hints and inlining for standard library functions. -
-