Difference between revisions of "Talk:Add - Array"

448 bytes added ,  18:41, 26 September 2016
no edit summary
imported>Goggle
imported>Qazaaq
Line 17: Line 17:
Likewise, the same issue appears with non-property arrays if you did not initialize it before.
Likewise, the same issue appears with non-property arrays if you did not initialize it before.
I would recommend to put this information somewhere on the array articles, as this can lead to some serious problems. It got me a good headache just to find that issue. [[User:Shirakami|Shirakami]] ([[User talk:Shirakami|talk]]) 2016-09-25T09:20:53 (EDT)
I would recommend to put this information somewhere on the array articles, as this can lead to some serious problems. It got me a good headache just to find that issue. [[User:Shirakami|Shirakami]] ([[User talk:Shirakami|talk]]) 2016-09-25T09:20:53 (EDT)
All you need to do is create a new array with a zero size. The zero size lets the array expand its length when used with the Array.Add and Array.Remove functions. There is no need to check if an array is none before setting its value.
<source lang="papyrus">
event OnInit()
    MyArray= New MyArrayType[0]
    MyArray.Add(someValue)
endevent
</source>
--[[User:Scrivener07|Scrivener07]] ([[User talk:Scrivener07|talk]]) 2016-09-26T18:41:39 (EDT)
Anonymous user