Module:Township: Difference between revisions

Add functions to get Buildings, Seasons, and Worships (for use in ModifierTables)
m (Support strongholds in getTaskReferenceTable)
(Add functions to get Buildings, Seasons, and Worships (for use in ModifierTables))
Line 286: Line 286:
return tierText
return tierText
end
end
end
function p.getBuildings(checkFunc)
local result = {}
for i, building in pairs(p.Township.buildings) do
if checkFunc(building) then
table.insert(result, building)
end
end
return result
end
function p.getSeasons(checkFunc)
local result = {}
for i, season in pairs(p.Township.seasons) do
if checkFunc(season) then
table.insert(result, season)
end
end
return result
end
function p.getWorships(checkFunc)
local result = {}
for i, worship in pairs(p.Township.worships) do
if checkFunc(worship) then
table.insert(result, worship)
end
end
return result
end
end