Is there a way to execute a line of code only if multiple statements are false?
I have an inventory:
inventory = {
{"Images/Category 1/pistol1.png", false},
{"Images/Category 1/machinePistol1.png", false},
{"Images/Category 2/shotgun1.png", false},
{"Images/Category 2/assaultRifle1.png", false},
{"Images/Category 3/sniperRifle1.png", false},
{"Images/Category 3/rocketLauncher1.png", false}
}
And I’d like to write a function that executes a line of code if all those statements are false, but obviously executes something else if even one of them is true.
You can use a variable, and assume it’s true
Then use that variable in expression
If you want it to execute with multiple falses, just count them. Add
local falseCount = 0at the beginning, and changebreakforfalseCount = falseCount + 1.