Fandom

Civilization

Module:Data/Civ2

< Module:Data

6,976pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

--Sub pages : 
--/Techs
 
local p = {}
 
--Utility functions
local function Link(s)
	return "[["..s.." (Civ2)|"..s.."]]"
end
 
local function LinkAll(t)
	local s = ""
	local first = true
	for k,v in pairs(t) do
		s = s..(first and "" or "<br/>")..Link(v)
		first = false
	end
	return s
end
 
function p.GetTechImage(frame, articlename)
    local PAGENAME = articlename or frame.args[1]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ2/Techs")[name]
	return data.epoch.."_"..data.category.."_advance_(Civ2).png"
end
 
 
function p.GetTechData(frame, articlename, key)
    local PAGENAME = articlename or frame.args[1]
    local key = key or frame.args[2]
	local name = string.gsub(PAGENAME, " %(.*","")
	local data = mw.loadData("Module:Data/Civ2/Techs")[name]
 
    for k,value in pairs(data) do 
        if k == key then
            if type(value) == "table" then
                return LinkAll(value)
            else
                return value
            end
        end
    end
    return ""
end
return p

Also on Fandom

Random Wiki