← 返回命令列表

Linux command

lua 命令

文本

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

常用示例

Start interactive interpreter

lua

Run script

lua [script.lua]

Execute code

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

Run with arguments

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

Show version

lua -v

Interactive after script

lua -i [script.lua]

说明

lua is the interpreter for the Lua programming language. Lua is a lightweight, high-performance, embeddable scripting language designed for extending applications. It features automatic memory management, first-class functions, and a simple but powerful data structuring mechanism (tables). The interpreter runs Lua scripts and provides an interactive REPL for testing code. Lua is widely used for game scripting (World of Warcraft, Roblox), embedded systems, configuration (Neovim, Nginx via OpenResty), and as an extension language in applications like Redis and Wireshark.

参数

-e _CODE_
Execute string.
-i
Interactive mode after script.
-l _MODULE_
Require module.
-v
Show version information.
-W
Turn warnings on.
--help
Display help information.

FAQ

What is the lua command used for?

lua is the interpreter for the Lua programming language. Lua is a lightweight, high-performance, embeddable scripting language designed for extending applications. It features automatic memory management, first-class functions, and a simple but powerful data structuring mechanism (tables). The interpreter runs Lua scripts and provides an interactive REPL for testing code. Lua is widely used for game scripting (World of Warcraft, Roblox), embedded systems, configuration (Neovim, Nginx via OpenResty), and as an extension language in applications like Redis and Wireshark.

How do I run a basic lua example?

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

What does -e _CODE_ do in lua?

Execute string.