Mapping question

Heyas,

As this roughly relates to an informational script I'm making...

Code:
record mytype {
  string area;
  item loot;
  int value;
};
 
mytype [int] map_of_type;

map_of_type is a map of records, of type mytype. I wanna sort it by a decreasing order of value.


Code:
sort map_of_type by -map_of_type.value;

does not work!! And i'm stumped. Anyone care to give me a pointer? : )

Cheers
RtD
 

jasonharper

Developer
Try:
sort map_of_type by -value.value;
The first 'value' is the variable implicitly created by the 'sort' statement, that successively holds each item in the map; the second 'value' is the field name you defined.
 
Top