I'm attempting to find the group member with the lowest health for establishing a heal target.
The following code is working, just wondering if there is a more efficient or alternative method for doing this activity.
function table.min( myTable)
local minValue
for name, value in ipairs( myTable) do
minValue = ((not minValue or value < minValue) and value) or minValue
end
return minValue
end
--Populate myGroup and myHpPercent from group command output triggers
myGroup = {"Drella", "Ilshad", "Idor", "Caleel", "Istria"}
myHpPercent = {100, 90, 49, 100, 50}
--Find index of lowest health% and utilize index to find player
print(myGroup[table.index_of(myHpPercent, table.min(myHpPercent))])
print(table.min(myHpPercent).."% of Max Health")
Thanks for any suggestions.
Drevarr