mirror of
https://github.com/packwiz/packwiz.git
synced 2025-11-18 17:14:32 +01:00
Prefer game versions according to acceptable versions list (fixes #181)
The acceptable versions list should now be specified in order of preference, where the last version is the most preferable Minecraft version
This commit is contained in:
@@ -145,3 +145,16 @@ func ComponentToFriendlyName(component string) string {
|
||||
return component
|
||||
}
|
||||
}
|
||||
|
||||
// HighestSliceIndex returns the highest index of the given values in the slice (-1 if no value is found in the slice)
|
||||
func HighestSliceIndex(slice []string, values []string) int {
|
||||
highest := -1
|
||||
for _, val := range values {
|
||||
for i, v := range slice {
|
||||
if v == val && i > highest {
|
||||
highest = i
|
||||
}
|
||||
}
|
||||
}
|
||||
return highest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user