Module:CombatAreas: Difference between revisions

Added p.getAreas so I can call it in CombatAreas/Tables
(Fixed an issue with getting difficulty not working when multiple difficulties were present)
(Added p.getAreas so I can call it in CombatAreas/Tables)
Line 67: Line 67:


   return nil
   return nil
end
function p.getAreas(checkFunc)
  local resultArray = {}
  for i, area in Shared.skpairs(AreaData.combatAreas) do
    local temp = processArea(area, i, 'combat')
    if checkFunc(temp) then
      table.insert(resultArray, temp)
    end
  end
  for i, area in Shared.skpairs(AreaData.slayerAreas) do
    local temp = processArea(area, i, 'slayer')
    if checkFunc(temp) then
      table.insert(resultArray, temp)
    end
  end
  for i, area in Shared.skpairs(AreaData.dungeons) do
    local temp = processArea(area, i, 'dungeon')
    if checkFunc(temp) then
      table.insert(resultArray, temp)
    end
  end
  return resultArray
end
end