Arithmetic ( + - * / % ^ )
Four basic operations, modulo, and exponentiation.
Syntax
a + b, a % b, a ^ b
Description
^ is the exponentiation operator (result is a float). // is floor division (Lua 5.3+).
Example
Loading editor…
Expected output
1 1024.0 3
When to use?
Calculations.
Common mistakes
- ⚠️ ^ result is a float: 2^10 → 1024.0. Use math.floor or // for an integer.