MAPPINGS.DOC
Mappings are rather simple and not overly complex. The basic thing is
structure.
For example:
map=(["helenette":1,"longshot":2,"colossus":3]);
That would allow you to index stuff like this:
map["longshot"]; would return 2 in this case
And you can replace the numbers by using stuff closed with " "
and thus it can look like this:
map=(["helenette":"great", "longshot":"grouchy", etc.);
and instead of returning 2 in the case of map["longshot"];
it would return grouchy. :)
Great huh? I figured this all by myself too :)
Finally you can use m_delete to delete from the array
and you can use map += to add to the array :)
another example:
map=([key0:data00;data01;...data0N,
key1:data10;data11;...;data1N,
...]);
you can access a value of the mappings with:
data0=map[key]; or dataN=map[key,n];
map[key]=data0; or map[key,n]=dataN;
if the <key> is not in the <map>, then 0 will be returned;
If there ar eless than <n> values per key in the map you'll get an
illegal indexing error.
As I said before you can add new entries in the mapping with the +=
map += ([key:data0;dat1;...;dataN]);
or if there is only one data entry per key with:
map[key]=data;
To check if a key is actually used in a mapping, you use the efun
mapping_contains();
if(mapping_contains(&data0,&data1,... &dataN,map,key)){
...
}
This way you can fetch all values associated to <key> from the mapping <map>.
Amylaar's driver supports call by reference and this efun makes use of it.
That's why there are '&' in front of the datas.
The technical stuff I asked people so I'm not a genius sorry.
Longshot