Hello there! I feel like I’m losing my mind because I’ve used structs for ages and thought I knew what I was doing but I guess not.
I’ve got a pretty simple function that takes in an inventory struct, makes a modification to its integer, and returns the struct (because I am aware there’s issues with structs and returning and refs).
For some reason, the modification is not happening. At all. Even within the function. I’m probably just going to use the make new struct and return that to get around this issue, but I’d like to know what I’m doing wrong (or if this is a bug).
Pardon the spaghetti, I wanted the print statement to be as descriptive as possible.
is because append is a pure function, so when u enter the first value the engine save the value of the first break structure an then in the last the engine read that value, that is why u have 9 in the begin and in the end.
to debug u can put a print before the set member and one after instead of use a print read values from the first and the second break and u can see u dont have any error in your struct
Sorry I meant to actually remove this as I figured it out an hour after but it was still in review so it wasn’t letting me. I was messing up outside of this function. This is a part of loop going through an array and the wrong integer was being used so instead of overriding the element I wanted it to, it was making a new element somewhere else. It wasn’t append or anything. In fact, once I fixed the integer the print was working just fine. Entirely my fault lol.