• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Is this information Correct and Accurate?

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,345
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 39
Joined
Feb 27, 2007
Messages
5,031
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,202
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