Module:TechLister/Techs

From Terra Invicta Official Wiki

Documentation for this module may be created at Module:TechLister/Techs/doc

---
---Reads the Tech data files and computes a table of Tech to Tech unlocks

--region Dependencies
local TechData = mw.loadData('Module:CSVReader/Tech')
--endregion

--region Private constants
--endregion

--region Private member variables
local techTable = {}
--endregion

--region Private methods

function getTechTable()
	for rowID, row in pairs(TechData) do
		for i = 0, 2 do
			prereq = row['prereqs/' .. i]
			if prereq and prereq ~= '' and prereq ~= 0 then
				if not techTable[prereq] then
					techTable[prereq] = {}
				end
				techTable[prereq][rowID] = true
			end
		end
	end
	return techTable
end

--endregion

--region Public methods
--endregion

return getTechTable()