When you put the data into the hashtable compare it to the current highest value and maintain that index instead of searching the table every time.

If you lose track of it or need to search every time for some reason loop through with the .data suffix

$hget(table,n).data