← 返回命令列表

Linux command

luajit 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start interactive interpreter

luajit

Run a Lua script

luajit [script.lua]

Execute a string of Lua code

luajit -e "[print('Hello')]"

Run a script with arguments

luajit [script.lua] [arg1] [arg2]

Save bytecode

luajit -b [script.lua] [script.out]

Load a library

luajit -l [library] [script.lua]

Enter interactive mode

luajit -i [script.lua]

说明

luajit is a Just-In-Time compiler for the Lua programming language. It provides significantly faster execution than the standard Lua interpreter through trace-based JIT compilation, an efficient interpreter, and a built-in FFI (Foreign Function Interface). LuaJIT is fully compatible with Lua 5.1 and includes several extensions. Script arguments are passed via the global `arg` table. Interactive mode is activated automatically when no script or `-e` option is provided.

参数

-e _chunk_
Run the given chunk of Lua code.
-l _library_
Load the named library, equivalent to require("library").
-b _..._
Save or list bytecode. Run without arguments to get help on options.
-j _command_
Perform a LuaJIT control command (e.g., -jv for verbose trace info, -jdump for detailed trace dumps).
-O_opt_
Control LuaJIT optimizations. -O0 disables all optimizations, -O (default) is equivalent to -O3.
-i
Run in interactive mode after executing the script or code.
-v
Show LuaJIT version.
-E
Ignore environment variables.
--
Stop processing options.

FAQ

What is the luajit command used for?

luajit is a Just-In-Time compiler for the Lua programming language. It provides significantly faster execution than the standard Lua interpreter through trace-based JIT compilation, an efficient interpreter, and a built-in FFI (Foreign Function Interface). LuaJIT is fully compatible with Lua 5.1 and includes several extensions. Script arguments are passed via the global `arg` table. Interactive mode is activated automatically when no script or `-e` option is provided.

How do I run a basic luajit example?

Run `luajit` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -e _chunk_ do in luajit?

Run the given chunk of Lua code.