title: table.sort throws " invalid order function"
body: <p>I'm developing a simple friend system and want to sort the friendData with some 
  rules.</p>
  
  <p>I compared two friends' status , level and offline-Time.</p>
  
  <p>PS:A friend has 3 status.(Online = 3,Busy = 2,Offline = 1).</p>
  
  <p>Here's my code.</p>
  
  <pre><code>local function compare(friend1,friend2)
      local iScore1 = 0
      local iScore2 = 0
      if friend1["eStatus"] &gt; friend2["eStatus"] then
          iScore1 = iScore1 + 1
      end
      if friend1["iLevel"] &gt; friend2["iLevel"] then
          iScore1 = iScore1 + 1
      end
      if friend1["iOfflineTime"] &lt; friend2["iOfflineTime"] then
          iScore1 = iScore1 + 1
      end
      return iScore1 &gt; iScore2
  end
  table.sort(FriendData,compare)
  </code></pre>
  
  <p>It works when I add several friends.But when I get more friends,It throws exception "invalid order function for sorting".
  Can someone please tell me how to fix it? :)</p>