Lua Operators-Lua Logical Operators - Lua (programming language)

What are the logical operators in Lua?

Below table shows all the logical operators supported by Lua language. Assume variable A holds true and variable B holds false then





Called Logical AND operator. If both the operands are non-zero, then condition becomes true.

(A and B) is false.


Called Logical OR Operator. If any of the two operands is non-zero then condition becomes true.

(A or B) is true.


Called Logical NOT Operator. Used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make false.

!(A and B) is true.


Try below example to understand all the logical operators available in the Lua programming language

When you build and execute the above program, it produces the following result

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Lua (programming language) Topics