(Why can't we just use arrays?)
string [int] MyMap;
string [6] MyArray;
MyMap[5] = "this works";
MyMap[100] = "this too";
MyArray[5] = "this works too";
foreach i, s in MyMap
print( "MyMap[" + i + "] = " + s );
foreach i, s in MyArray
print( "MyArray[" + i + "] = " + s );
int index = 100;
MyArray[index] = "this generates a runtime error";
> ma.ash
MyMap[5] = this works
MyMap[100] = this too
MyArray[0] =
MyArray[1] =
MyArray[2] =
MyArray[3] =
MyArray[4] =
MyArray[5] = this works too
Array index out of bounds (ma.ash, line 17)
If someone has admin access to the wiki, they may want to add to the "file_to_map()" entry that the items in the file need to be tab-separated (at least on Windows). It's not readily apparent in the example, and I tried to use spaces... which didn't work.
You want arrays? ASH has them. An array can be considered to be a map that has integer keys numbered from 0 to <n>.
Code:string [6] MyArray;
ash string [5, 5] multi_dim_array; foreach i,m in multi_dim_array print(i+":"+m)