this isn’t working:
First, I get an array of the user’s facebook friends. I get an array of “drUser” objects. each object has a string called “platformName” that I want to use to sort the drUser objects in the array.
yield drClient.User.FetchAllFriends();
yield drClient.User.FetchAppFriends();
loadMyFriends = true;
appFriends = drClient.User.localUser.appFriends;
friends = drClient.User.localUser.socialNetworkFriends;
appFriends.Sort(SortFriendsByName);
friends.Sort(SortFriendsByName);
the sort function i’m using is this:
function SortFriendsByName(a, b)
{
var tempArray : Array = new Array(a.platformName, b.platformName);
tempArray.Sort();
if(a.platformName == tempArray[0])
return -1;
else
return 0;
}
It’s not working. unity tells me the following:
Assets/Scripts/Singleton/FriendManager.js(36,40): BCE0017: The best overload for the method ‘Array.Sort()’ is not compatible with the argument list ‘(callable(Object, Object) as int)’.
any help would be fantastic.
Thanks folks.