- Joined
- Mar 17, 2007
- Messages
- 399
Solved thank you.
Last edited:
Like everything in JASS, it happens "instantly" as far as the game state is concerned. However it will pick them in an unspecified sequence due to how computers work. Since WC3 is only "single threaded" you do not have to worry about race conditions, each loop iteration will execute completely before the next can begin.Does this loop pick through all units individually or all at once? I would assume it's looping hella fast but I would still like to make sure respectively.
Yes, each time around the loop it will overwrite the contents of that variable. If the variable is being used only within the loop this is fine and even a good way to speed up the code however if you use the contents after loop completion you will be using an unspecified unit which is generally not a good thing.Set MyPickedUnit = (Picked unit) <--- Wouldn't this overwrite?
It is needed to allow the unit handle index to be recycled once (if) the unit is removed. If the variable is used a lot it makes no difference and is even bad for performance as it will be recycled sooner or later once a new value is assigned anyway. Only null unit variables if the variable is not used often or will never be used again for the rest of the session.Set MyPickedUnit = No unit <--- Was told to put this here but no given reason to why other than the value gets a null, the specified location is what I want to know not why it saves space
Yes, each time around the loop it will overwrite the contents of that variable.
There was only 1 (memory) block, and it is being re-used every time the group callback (the loop) is ran.Recycles only 1 block? What of the other 2?
What I don't understand of these examples is why the variable gets "nulled" outside of the loop & not inside the loop, when inside the loop I don't know if it's creating a infinite loop, I don't know if it's going back to the first [x] it picked, I don't know if it's even picking any [x] at all to be honest. With that being said I'm blinded by seeing how the null outside the loop works other than clearing it to prevent lag.