so i dont know what to do
local votes = {
TestMapVotes = 1,
TowerMapVotes = 12
}
local highest = math.max(unpack(votes))
print(highest)
so i dont know what to do
local votes = {
TestMapVotes = 1,
TowerMapVotes = 12
}
local highest = math.max(unpack(votes))
print(highest)
I don’t think you can unpack a dictionary like this.
Try this:
local votes = {
TestMapVotes = 1,
TowerMapVotes = 12
}
local function GetHighestValue(dictionary)
local highestValue = 0
for valueName, value in pairs(dictionary) do
if value > highestValue then
highestValue = value
end
end
return highestValue
end
print(GetHighestValue(votes))
how can I do if TowerMapVotes is the highest then or if TestMapVotes then?
nvm got it