What does the "or" operator mean in Lua?

I want to know what the OR operator is used for and if it is useful.

It is useful, or is used do 2 things in a line. Example: + 1 or + 4

So or is the same thing as and?

No. Or can make you do random, and is both doing it.

Or is basically telling the code “I want to do this if this is true or this is true”

Example

local x = true
local y = false

if x or y then --If one of these is true
    print("This will work since x is true!")
end
1 Like

More info can be found from the following pages, if needed. There are examples using these different Operators there :slight_smile:

Conditional Statements

List of Operators