How do I compare a variable to other values?

So I am trying to compare a variable to two other values.

For example, I want to find if a variable is equal to 2 other values with doing v

if var == 1 or var == 2 then

although I have tried an alterative, the second or statement doesn’t work though…

if num == (1 or 2) then

I don’t know if this is possible but I don’t know what else to try.

It has to be if num == 1 or num == 2 instead

You can either do your first option or use a table to store the possible truthy statements:

local otherVars = {1, 2}

if table.find(otherVars, var) then
    -- If "var" is found in the table then var is equal to one of the variables
end

Make sure it’s an array and not a dictionary as you can’t use table.find on a dictionary.