[Trigger] 2d integer array?

Status
Not open for further replies.
Level 3
Joined
Aug 22, 2009
Messages
51
Well, i know there is a normal integer array and hashtables, but what if i need a 2d ( 2 dimensional ) integer array?
using the hashtable is the only way?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Or you can use a dynamic array and extend the limit so that it can process more indexes. This is of course just a vJass trick, it does not "take away" those limits.

JASS:
type int2d extends integer array [200, 40000]

This will make an array with 200 maximum instances, each with a size of 200.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Berb, that purly puts multiple arrays in series and probably uses the same formla I provided. In our case thats 4 arrays in series.

SlayerII, although hashtables do seem to act like 2D arrays and can be used as them, it is still more efficent to use a proper array in a 2D mode like that I provided. Hashtable lookup is great for wide range data while keeping lookup speeds near constant but can never beat a simple array.
 
Status
Not open for further replies.
Top