Module:Data tables/parachutes
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Data tables/parachutes/doc
local p = {}
local _commonCells = require("Module:Data tables/common").commonCells
local _commonHeaders = require("Module:Data tables/common").commonHeaders
local _formatResource = require("Module:Data infobox")._formatResource
-- Builds table formatted for parachutes
function p.parachuteTable(args)
local category = args[1]
local family = args[2]
local json = mw.loadJsonData("GameData:Collections/parts")
local cells = ''
-- add parachute headers
local headers = _commonHeaders() ..
"!Semi-Deployed Drag (kN)\n" ..
"!Deployed Drag (kN)\n"
-- populate cells
for k, v in pairs(json[category][family]) do
local partJson = mw.loadJsonData("GameData:"..k)
local tempCell = _commonCells(partJson) ..
"|"..partJson["modules"]["parachute"]["drag"]["semi_deployed"].."\n" ..
"|"..partJson["modules"]["parachute"]["drag"]["deployed"].."\n"
cells = tempCell..cells
end
-- append the cells to the headers and cap off the table wiki text
local parachuteTab = headers..cells.."|}"
return parachuteTab
end
return p