-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Short description
Using the add assignment (+=) operator does not produce the expected value /within/ a progress block. It appears that between iterations of a progress block the value is correct.
Minimal liftoscript reproducer
Squat / 3x5 / 3x3 / 3x1 / progress: custom() {~
print(setVariationIndex)
setVariationIndex += 1
print(setVariationIndex)
~}
Running this program, I observe the following prints stepping through 3 days in the playground:
# Day 1
1
1 // <- expect 2!
# Day 2
2
1 // <- expect 3!
# Day 3
3
1 // <- Not sure if this is expected, is setVariationIndex automatically modded?
Variables impacted
I tested setVariationIndex and reps[1]. Both had issues. state variables appeared to not be impacted.
Workaround
Instead of using the add assignment operator, explicit add and assignment appears to work:
Squat / 3x5 / 3x3 / 3x1 / progress: custom() {~
print(setVariationIndex)
setVariationIndex = setVariationIndex + 1
print(setVariationIndex)
~}
I just discovered liftosaur and I think it's pretty amazing! I'm happy to take a look at this issue later in the week when I get the repo setup locally. Depending on the difficulty of the fix, it might be better to just throw a descriptive warning if a user attempts to use += with non-state variables.