Be aware, that this method does not work together with most unit indexers. If you have one of these unit indexers in your map, you can easily use it to achieve the same using an integer array.
So hastables are like "custom values" of units?.
A hashtable is like an array with two indexes. You can store value of any type (integer, real, unit, point,...) in a certain position (row, column) in the table.
The row and column are specified by integers.
There is a function to get the key of an object. This key is a unique integer for every object in the game. This key can then be used in the hashtable. With this key we can store data for a specific object (often times a unit).
For example to store an integer for a unit we can use:
-
Hashtable - Save 4 as (Key (Triggering unit)) of 0 in Table
This is very similar to setting custom value of the Triggering unit to 4. However with the hashtable you can store a basically unlimited number of variables (also non-integer variables) for a unit.
To store a unit as well, we can store it in a different position in the hashtable:
-
Hashtable - Save Handle Of(Target unit of ability being cast) as (Key (Triggering unit)) of 1 in Table
The key function can also be used for other objects, so you can store values for basically every object in the game (destructible, unit type, item, timer, region, player, unit group, point, ...)
For more information check out some of the tutorials on this site. For example:
Hashtables and MUI
A Complete Beginners Guide to Hashtables