Sort only considering last entry in my array

I'm filling up this array with these custom IComparable objects and then trying to sort them. My problem is that when it does the sort it's only considering the last entry in the array. This custom class stuff is a little over my head so any help will be greatly appreciated.

import System;

class PriorityEntry extends System.IComparable {
    var gD : float;
    var tD : float;
    var xC : float;
    var yC : float;
    var fR : float;
    var sR : float;

    function CompareTo(other : System.Object) : int
    {
        if (!(other instanceof PriorityEntry)) return;
        var peOther : PriorityEntry = other;
        if( gD != peOther.gD ) return gD.CompareTo(peOther.gD);
        if( tD != peOther.tD ) return tD.CompareTo(peOther.tD);
        if( fR != peOther.fR ) return fR.CompareTo(peOther.fR);
        if( sR != peOther.sR ) return sR.CompareTo(peOther.fR);
    }
}

sorry, the code formatting is not cooperating with me for some reason.

Wow... there are lots of potential problems here.

First and foremost, read the MSDN documentation on CompareTo:

http://msdn.microsoft.com/en-us/library/system.icomparable.compareto(VS.71).aspx

Now... the potential problems I see are:

if (!(other instanceof PriorityEntry))

I don't know how UnityScript works, but that might have to be "is" instead of "instanceOf".

if (!(other instanceof PriorityEntry)) return;

ICompare.CompareTo always returns an int. Throw an exception if you can't return an int.

A lot of this I'm not sure about. For .NET-intensive things like this (implementing interfaces, overriding methods, type-checking, etc), you really should be using C#, instead of the poorly-implemented UnityScript. This is what your script would look like in C#:

using System;

public class PriorityEntry : IComparable {
    float gD;
    float tD;
    float xC;
    float yC;
    float fR;
    float sR;

    public int CompareTo(Object other)
    {
        if (!(other is PriorityEntry))
        {
             throw new Exception("Cannot compare!");
        }

        PriorityEntry peOther = other as PriorityEntry;

        if (gD != peOther.gD) return gD.CompareTo(peOther.gD);
        if (tD != peOther.tD) return tD.CompareTo(peOther.tD);
        if (fR != peOther.fR) return fR.CompareTo(peOther.fR);
        if (sR != peOther.sR) return sR.CompareTo(peOther.fR);

        // You need to return something here, too, or use an if/else structure.
    }
}