user1542285
user1542285

Reputation:

"or if" logical operation in Lua

I'm in a situation where I have

if A and B and C then
X
end

Which if I understood it correctly, means it will only execute X if all three conditions (A,B,and C) are met.

That's fine by itself, But, I need/want it to at the same time also check something that's like an "or if" statement, that is.

if A and B and C [or if] A and D [or if] A and E then X End

Meaning I want it to execute X when A and B and C are met, or if A and D are met, or if A and E are met. How do I go about doing that?

Upvotes: 1

Views: 5420

Answers (1)

Nican
Nican

Reputation: 7945

Simple:

if (A and B and C) or (A and D) or (A and E) then
    X
end

Upvotes: 6

Related Questions