運算子 (Operators)
Lua 支援數學與邏輯運算子(operators),如下:
+— 加法(addition)-— 減法(subtraction)*— 乘法(multiplication)/— 除法(division)^— 次方(power)%— 取餘數(modulus)..— 組合兩個字串(concatenate)==— 等於(equal to)~=— 不等於(not equal to)<— 小於(less than)<=— 小於或等於(less than or equal to)>— 大於(greater than)>=— 大於或等於(greater than or equal to)and— 用連接兩個操作以作邏輯運算,當兩者皆為真,整體才為真or— 用連接兩個操作以作邏輯運算,只要其中一者為真,整體為真not— 反轉值,大部份的情況是布林(Boolean)值, i.e. not true = false, not false = true, not nil = True