Module:Data tables/pods: Difference between revisions
Jump to navigation
Jump to search
commonCells not a p. func |
remove reference to commons |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local dataTables = require('Module:Data tables') | local dataTables = require('Module:Data tables') | ||
-- Builds table formatted for command pods | -- Builds table formatted for command pods | ||
Line 10: | Line 8: | ||
-- adds command module values | -- adds command module values | ||
local header = | local header = | ||
"!Crew\n" .. | "!Crew\n" .. | ||
"!Electric Charge (U)\n" .. | "!Electric Charge (U)\n" .. | ||
Line 23: | Line 21: | ||
for k, v in pairs(json[category][family]) do | for k, v in pairs(json[category][family]) do | ||
local partJson = mw.loadJsonData("Data:"..k) | local partJson = mw.loadJsonData("Data:"..k) | ||
local tempCell = | local tempCell = | ||
"|"..partJson["modules"]["command_module"]["crew_capacity"].."\n" .. | "|"..partJson["modules"]["command_module"]["crew_capacity"].."\n" .. | ||
"|"..partJson["resources"]["electric_charge"].."\n" .. | "|"..partJson["resources"]["electric_charge"].."\n" .. | ||
Line 32: | Line 30: | ||
-- append the cells to the headers and cap off the table wiki text | -- append the cells to the headers and cap off the table wiki text | ||
local | local headerCells = {header, cells} | ||
return | return headerCells | ||
end | end | ||
return p | return p |
Revision as of 05:11, 1 February 2025
Documentation for this module may be created at Module:Data tables/pods/doc
local p = {}
local dataTables = require('Module:Data tables')
-- Builds table formatted for command pods
function p.podTable(args)
local category = args[1]
local family = args[2]
-- adds command module values
local header =
"!Crew\n" ..
"!Electric Charge (U)\n" ..
"!Monopropellant (t)\n" ..
"!Torque (kN)\n"
local cells = ""
-- load the full parts list to iterate per given category and family
json = mw.loadJsonData("Data:Collections/parts")
-- each applicable part's data is appended to the table cells
for k, v in pairs(json[category][family]) do
local partJson = mw.loadJsonData("Data:"..k)
local tempCell =
"|"..partJson["modules"]["command_module"]["crew_capacity"].."\n" ..
"|"..partJson["resources"]["electric_charge"].."\n" ..
"|"..partJson["resources"]["monopropellant"].."\n" ..
"|"..partJson["modules"]["reaction_wheel"]["torque"]["pitch"].."\n"
cells = tempCell..cells
end
-- append the cells to the headers and cap off the table wiki text
local headerCells = {header, cells}
return headerCells
end
return p