If you add new members to a list in the middle of the for list loop, these new members won't be part of the current for proc.
Numbered Steps to Reproduce Problem:
copy paste the code below, notice how instead of having an infinite loop, you'll only loop once.
Code Snippet (if applicable) to Reproduce Problem:
var/list/L = list()
var/obj/O = new(src)
L += O
for(var/obj/P in L)
var/obj/N = new(src)
L += N
I expect the for loop to run through the new members added in the middle of the process
They are being ignored, the for loop will finish without looping through the new members.
Does the problem occur:
Every time? Or how often? always
In other games? no game-specific
In other user accounts?not related
On other computers?not related
When does the problem NOT occur?
In older versions of byond, I can't say which one exactly, but we do have chunks of code that use this system, currently they are now bugged due to this bug.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
var/object = list[i]
using this for loop works, but extremly laggy due to byond using linked lists (at least laggy with lists of a lot of members)