I know this is two years later, but this is for all those who found this post with the same question.
Try the function "Get Selected Rows" in your script.
yourarray = dt << Get Selected Rows;
Now the array "yourarray" will contain a list of the row numbers that are selected.
To find the rows with the maximum value, try
// finds the maximum value in the columnt
peakvalue = Col Max( :columname);
// selects all rows with the maximum value. (dt is the name of the data table.)
dt << Select Where( :columnname == peakvalue);
// stores a list of the row numbers with the maximum value in this array
yourarray = dt << Get Selected Rows;