Originally Posted by semlar
You can't do "if var == 1 or 2 or 3", it's not the same as "if var == 1 or var == 2 or var == 3", it will always return true because "if 2" will always evaluate to true.
|
To clarify even further:
Code:
if var == 1 or 2 or 3 then
-- do X
end
Is functionally identical to:
Code:
if var == 1 then
-- do x
elseif 2 then
-- do x
elseif 3 then
-- do x
end
It is
NOT the same as:
Code:
if var == 1 then
-- do x
elseif var == 2 then
-- do x
elseif var == 3 then
-- do x
end
If you want to do that third thing in one go, you need to write it this way:
Code:
if var == 1 or var == 2 or var == 3 then
-- do x
end