Hello,
While making my escape room game I have ran into a problem. I’m stupid . Here’s the problem: I have some variables containing conditions (I try to write clean code
) that need to be checked to open a door. I just can’t find an elegant way of doing that
.
-- The variables (I have removed the conditions for simplicity)
local doorIsOpen
local powerIsRequired
local powerIsTurnedOn
local doorIsLocked
local playerHasKey
local doorRequiresKeyPad
local keyPadIsUnlocked
All of these variables are available for use, and I need to check all the unique combinations possible , e.g.
if not doorIsOpen and powerIsRequired and powerIsTurnedOn and not doorRequiresKeyPad then
-- Open door
elseif not doorIsOpen and doorRequiresKeyPad and keyPadIsUnlocked and powerIsRequired and powerIsTurnedOn then
-- Open door
end
I assume that you now see the problem. Any ideas?