lbmaster 21 Posted April 27, 2019 Hey, I already have scripted many things, but I still not 100% understand, when I have to use the "ref" keyword infront of variables. I understood, that I have to use them infront of arrays, otherwise DayZ gives me an error. Now I'm completly stuck with the following array: ref array<ref Param2<ref array<ref TStringArray>, ref array<ref TStringArray>>> loadouts = new array<ref Param2<ref array<ref TStringArray>, ref array<ref TStringArray>>>(); Looks a bit complicated ^^. I filled the array with variables when I created the object and it gave me the correct count of items in the array, when I checked it, but if I select an item from the loadouts list it returns a null reference and it seems like the "garbage collection" of the DayZ Engine may have deleted my variables. How can I fix this and when do I use those wierd references ? LBmaster Share this post Link to post Share on other sites
GravityWolf 0 Posted May 9, 2019 (edited) I will try to answer your question, but first, I will have to explain the opposite of the ref keyword, and that would be autoptr. autoptr would be concidered a weak reference to memory, and any object variable marked as a autoptr would be removed from memory after hitting the end of the scope, IE the next closing curly bracket. Alternatively, ref is a strong reference forcing the variable to stay in memory until the object's destructor is called, or where ever you plan to release it. I only use ref on class variable types, and the generic types for arrays/maps/sets, but never anything else. You always have my discord if you have questions. Edited May 9, 2019 by GravityWolf Share this post Link to post Share on other sites