WurstScript
WurstScript copied to clipboard
"The assignment to local variable _ is never read" - incorrect
Describe the bug When a for-to loop's body mutates its iteration index, the exit condition doesn't correctly trigger "variable read".
- Example:
for i = 0 to stackPointer
Invulnerable wrapper = invulns[stackPointer]
wrapper.durationLeft -= FIDELITY
if wrapper.durationLeft <= 0.
wrapper.which.removeAbility(ID_INVULNERABLE)
destroy wrapper
invulns[i] = invulns[stackPointer]
stackPointer--
i--
Error says: The assignment to local variable i is never read.
Hmm, the for loop variable was not meant to be mutated manually. Will probably replace this with a different warning ;)