I am keeping a list of an NPC’s “needs” in a Dictionary
public var needs : Dictionary.<String,int> = new Dictionary.<String,int>();
The key is the name of the need, and the value is numeric. How can I sort the dictionary by value? I’ve found a few examples in C# that use Linq, but I haven’t been able to translate it to Javascript.
Any help would be appreciated
Update:
I think I’ve solved my problem for now:
needs.OrderBy(function(need){ need.Value; }).
Thanks to http://unitygems.com/linq-1-time-linq/