what about something like:
Code:

function indexes_of_smallest_values($array, $howMany)
dim $helper[0],$output[$howMany], $sc
for $=0 to ubound($array)
$val = $array[$]
if $val>ubound($helper)
redim preserve $helper[$val]
endif
$helper[$val] = $helper[$val] + " " + $
next
for $=0 to ubound($helper)
for each $index in split($helper[$])
if len($index)
$output[$sc] = $index
$sc = $sc + 1
endif
if $sc>$howMany
exit 0
endif
next
next
$index_of_smallest_values = $output
endfunction



it does not support negative numbers, but surely is shorter than the sorting scripts posted before...


Edited by Jooel (2006-06-20 06:47 AM)
_________________________
!

download KiXnet