associate number with item in array and take highest

I have I guess very stupid problem to solve and I'm out of ideas so I would be grateful for help.
I have array with filenames. it look like this:
my_files=#("textures/head.jpg","robocop/textures/head.jpg","d:/work/robocop/textures/head.jpg")

My function generate some numbers after checking each item from array like:
item 1 - number is 22, item 2 - number 11, item 3- number 7 etc.
Now I must take item(in my case fileneme) with highest number.
How can I do it, how can I associate number with item in array, then take item(in my case filename) with highest number?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

It's very simple

my_files=#("textures/head.jpg","robocop/textures/head.jpg","d:/work/robocop/textures/head.jpg")
my_vals = #(22,11,7)
idx = findItem my_vals (amax my_vals)
filename = my_files[idx]

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.