Module:Structures

--For use in automating assorted wiki functions and to reduce the number of updates needed local p = {} local StructureData = mw.loadData( 'Module:Structures/data' ) function p.getStructure(StructureName) local Structure = StructureData["Structures"][StructureName] if Structure ~= nil and Structure.Name == StructureName then return Structure end return nil end local function getValue(Structure, ValName) return Structure[ValName] end function p.getValue(frame) local StructureName = frame.args[1] local ValName = frame.args[2]

if(StructureName == nil) then return "" elseif(ValName == nil) then return "ERROR: Missing ValName parameter" end local Structure = p.getStructure(StructureName) if(Structure == nil) then return "" end return getValue(Structure, ValName) end

local function getTier(Structure, TierName) return Structure[TierName] end function p.getTierValue(frame) local StructureName = frame.args[1] local TierName = frame.args[2] local ValName = frame.args[3] if(StructureName == nil) then return "" elseif(TierName == nil) then return "ERROR: Missing TierName parameter" elseif(ValName == nil) then return "ERROR: Missing ValName parameter" end local Structure = p.getStructure(StructureName) if(Structure == nil) then return "" end local Tiers = Structure.Tiers if(Tiers == nil) then return "" end return getValue(Structure, ValName1) end return p