Skip to content
#1176
Auto-translated
RedHeavenHero
GetPlayerState(i) == 1 or 0
If the function returns one (the player is alive), then "==" will return 1, and this 1 will be added to n; otherwise, it will return nil. But nil cannot be added, and the "or" operation replaces it with 0.
I understand, so this is a drawback of the construction.
n = n + (isCondition or 0)

Therefore, I advise using a more readable alternative instead (instead of trying to add numbers with logic):
if (isCondition) then
n = n + 1
end

And it will not cause any questions.

Statistics

Welcome our newest member: Emil