Civilization Wiki
Advertisement
Civilization Wiki

Documentation for this module may be created at Module:Data/CivBE/Utils/doc

local baseUtils = require("Module:Data")

local p = {}


function p.GetCivilization(name,expansion)
    expansion = expansion or "Base"
    
    local civData = mw.loadData("Module:Data/CivBE/"..expansion.."/Civilizations")
    
	local baseData = baseUtils.SelectFromWhere(civData, "Description", name)
    or baseUtils.SelectFromWhere(civData, "ShortDescription", name)
    
    if not baseData then
    	for _,civ in pairs(civData) do
        	if civ.CivilopediaTag and (civ.CivilopediaTag.TITLE == name) then
        	    return civ
        	end
    	end
end

    return baseData
end

return p
Advertisement