Jump to content

Question about arrays.


Legotrash

Recommended Posts

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by QQuix
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...