It was a bit tricky figuring out what is going on, but. Because Lists are passed by reference, within the whole script the “buffer_List” is passed by reference. This is why any changes made anywhere that list is referenced (“buffer_struct4”, “buffer_List” and “List_Struct4”) also take place everywhere else that list is referenced as well.
Thus what is happening in your script is that you are basically “Adding” the same list reference to the “List_Struct4” on each iteration and by the end “List_Struct4” ends up having 3 references of the same list.
The important thing is that Lists are passed by reference and structs are passed by value. A List in a Struct (as in your case) is still passed by reference.
I hope this helps. Let me know.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.