Legotrash Posted May 7, 2013 Posted May 7, 2013 I've made a quest script with two different arrays which contain stringmaps with references. Will I need to erase them for a possible uninstallation? I've seen that some modders erase their arrays but I'm still not much experienced and I don't know when and if it's necessary.
QQuix Posted May 7, 2013 Posted May 7, 2013 No arrays do not have to be erased. OBSE keeps track of a use-count for each array and automatically deletes them when it reaches zero uses. But, as with any other resource available to the modder, it is good practice to release them as soon as you know the info will not be necessary anymore. (note that this is not true for string vars. These you have to erase yourself) If a mod is uninstalled, its arrays are removed from the save file. (not sure about string vars, thou)
Legotrash Posted May 8, 2013 Author Posted May 8, 2013 Thank you QQuix. I have one new question though (sorry! xD). Can I just erase the two main arrays (they're nesting all the rest..."nesting" is the right word,right? oh well :P ),will that erase all the stringmaps too?
QQuix Posted May 8, 2013 Posted May 8, 2013 (edited) Yes, if you erase the top level, all arrays contained within will be erased also (once the master array is removed, all the arrays 'below' will have their use count reduced by one and, provided no other var points to them, the use count will be zero and the array will be deleted from the game the next time the garbage collector runs) This is true for all kinds of arrays: Map, Stringmap and Array. [EDIT] And don't use 'Set MyArrayVar to 0' to erase an array. Set is not an OBSE function and will mess up all OBSE controls I mentioned above. Use 'Let MyArrayVar := ar_Null' instead Edited May 8, 2013 by QQuix
Legotrash Posted May 9, 2013 Author Posted May 9, 2013 Thank you very much QQuix! I can finally say that I don't have any more questions...well,for know. O_o xD Thanks again!
Recommended Posts