Lua — Command Reference
Lua's most used commands — a simple scripting language widely used in games and embedded systems. Each with an explanation and a working example.
7 categories · 18 commands
🖥️
Output
print and formatting.
print()Concatenation ( .. )string.format()📦
Variables
local, global, and nil.
local / variablenil🔢
Numbers & Math
Arithmetic and the math library.
Arithmetic ( + - * / % ^ )math.sqrt / math.floor✍️
String
Length, uppercase, substring, and search.
#text / string.upperstring.sub / string.find📋
Table
Lua's only data structure: acts as both an array and a dictionary.
Table (as an array)table.insert / table.removeTable (as a dictionary)🔁
Condition & Loop
Decision making and repetition.
if / elseif / elsefor (numeric)ipairs / pairswhile🧩
Function
Function definition.
functionMultiple return