Module:CombatAreas: Difference between revisions

fixed a typo
(Added new function for auto-building dungeon monster tables)
 
(fixed a typo)
Line 10: Line 10:
function p.getArea(name)
function p.getArea(name)
   local result = nil
   local result = nil
  mw.log(name)
   --There are three types of areas but the lists are pretty short so looping all of them isn't a real issue
   --There are three types of areas but the lists are pretty short so looping all of them isn't a real issue
   for i, area in pairs(AreaData.combatAreas) do
   for i, area in pairs(AreaData.combatAreas) do
Line 41: Line 42:
function p.getAreaMonsterTable(frame)
function p.getAreaMonsterTable(frame)
   local areaName = frame.args ~= nil and frame.args[1] or frame
   local areaName = frame.args ~= nil and frame.args[1] or frame
   local area = p.getArea(frame)
   local area = p.getArea(areaName)
   if area == nil then
   if area == nil then
     return "ERROR: Could not find an area named "..areaName
     return "ERROR: Could not find an area named "..areaName
Line 66: Line 67:
function p.getDungeonMonsterTable(frame)
function p.getDungeonMonsterTable(frame)
   local areaName = frame.args ~= nil and frame.args[1] or frame
   local areaName = frame.args ~= nil and frame.args[1] or frame
   local area = p.getArea(frame)
   local area = p.getArea(areaName)
   if area == nil then
   if area == nil then
     return "ERROR: Could not find an area named "..areaName
     return "ERROR: Could not find a dungeon named "..areaName
   end
   end