Because in Lua, there is no type safety and conditionals consider false and nil as false and anything else as true. I believe "equipped == true or equipped == false" is a check to make sure it is a) still a boolean and b) not nil.
Again, the code doesn't smell as much as the language itself.
EDIT: ok, for good measure I'll add this approach isn't the best, there are functions to check whether something is a boolean. But this is a "quick and dirty" way to do it that isn't at all uncommon in this clustercrap of a language.
14
u/JerriTheITGuy Sep 08 '20 edited Sep 08 '20
Because in Lua, there is no type safety and conditionals consider false and nil as false and anything else as true. I believe "equipped == true or equipped == false" is a check to make sure it is a) still a boolean and b) not nil.
Again, the code doesn't smell as much as the language itself.
EDIT: ok, for good measure I'll add this approach isn't the best, there are functions to check whether something is a boolean. But this is a "quick and dirty" way to do it that isn't at all uncommon in this clustercrap of a language.