Does Lua have OR comparisons?

Polyov picture Polyov · Jun 30, 2012 · Viewed 55.2k times · Source

I'm just starting out using Lua, and I was wondering (because I can't find it on the website) if Lua has a OR operator, like how in other languages there is ||:

if (condition == true || othercondition == false) {
 somecode.somefunction();
}

whereas in Lua, there is

if condition then
    x = 0
end

how would i write an IF block in Lua to use OR?

Answer

Puppy picture Puppy · Jun 30, 2012

With "or".

if condition or not othercondition then
    x = 0
end

As the Lua manual clearly states.