for PendantName, PendantInfo in pairs(PendantIndex) do
if PendantInfo.Type == "Regular" then
table.insert(PendantOptions, PendantName)
elseif PendantInfo.Type == "Seasonal" then
if PendantInfo.Season == "Winter" and (CurrentMonth == "01" or CurrentMonth == "02" or CurrentMonth == "12") then
table.insert(PendantOptions, PendantName)
elseif PendantInfo.Season == "Spring" and (CurrentMonth == "03" or CurrentMonth == "04" or CurrentMonth == "05") then
table.insert(PendantOptions, PendantName)
elseif PendantInfo.Season == "Summer" and (CurrentMonth == "06" or CurrentMonth == "07" or CurrentMonth == "08") then
table.insert(PendantOptions, PendantName)
elseif PendantInfo.Season == "Fall" and (CurrentMonth == "09" or CurrentMonth == "10" or CurrentMonth == "11") then
table.insert(PendantOptions, PendantName)
end
end
end
For context, my script iterates through all ‘pendants’ and if its type is the current real life season, it’ll be added to a table of pendants in the shop. I’m looking for a better way than a huge elseif chain, if there is one. Thanks!