Line 76: |
Line 76: |
| end | | end |
| return false | | return false |
| + | end |
| + | |
| + | function Utils.imax(arr) |
| + | local maxValue |
| + | local maxIndex |
| + | for i, v in ipairs(arr) do |
| + | if not maxValue or v > maxValue then |
| + | maxValue = v |
| + | maxIndex = i |
| + | end |
| + | end |
| + | return maxIndex |
| end | | end |
| | | |