• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Is this information Correct and Accurate?

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,351
Size
Arrays in JASS all have the same max index of 8192. This means that the 'size' field for arrays in the WE is useless (to my knowledge). In this sense arrays are more like hash-tables, as you will not recieve an 'index out of bounds' error. But it also means that every array you make will occupy a certain amount of space no matter how much or little data is put into it.

Source:Triggers - Variables and Arrays

is this information correct and accurate?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Max size is now ~32k. Size of N populates indices 1-N with some default value on map init but does nothing else. For primitive variables (int,real,string,boolean) this size doesn't matter but for some objects like unit groups it might. Basically leave it at 1 unless you find you need to change it for some reason.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
The maximum size of a JASS2 (Warcraft III JASS) array is specified by the constant JASS_MAX_ARRAY_SIZE.

For example on the 1.31 PTR this is defined as...
JASS:
constant integer JASS_MAX_ARRAY_SIZE=32768
I know this value has been in use in 1.30.4 as well. However what the actual definition is does not matter. One must use the constant JASS_MAX_ARRAY_SIZE in case the value changes in future patches.

JASS2 arrays are dynamic, non shrinking, arrays. If you only use the first few indices then they will allocate only a small amount of storage compared with if you use the last index. This means that arrays mapping data to player slots will use little memory compared with arrays used to back some highly complex dynamic structure with 10,000+ indices. Each index is 4 bytes and I recall someone mentioning the backing memory for the array is resized in powers of two.
 
Status
Not open for further replies.
Top