Is there a shorter way to check multiple for multiple values?

Is there a shorter way to do this?

if wave.Value == 1 or wave.Value == 2 or wave.Value == 3 or wave.Value == 4 or wave.Value == 6 then

2 Likes

I’m assuming there’s no wave 0 so just do if wave.Value < 7 or if wave.Value <= 6.

2 Likes

If they are specific values

if table.find({1, 2, 3, 4, 6},wave.Value) then
3 Likes

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

I’ll try this
Yes there are specific values like 1,2,3,4,6,7,8,9,11,12,13,14,16,17,18,19,21,22,23,24
Every 5 round there is a boss fight like 5,10,15,20,25

If you have an arbitrary (potentially infinite or large) amount of waves that can be active in a game’s lifetime then you can check if the wave’s value does not evenly divide into 5 with modulus. If it does, this will tell you that the number is a multiple of 5. You will know if modulus returns 0.

if not (wave.Value % 5 == 0) then -- Not a boss wave

This also assumes you don’t have a Wave 0 otherwise that’d be valid as well.

3 Likes