Module:Data tables/pods: Difference between revisions
Jump to navigation
Jump to search
change require format |
updated NS ref |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local | local _commonCells = require("Module:Data tables/common").commonCells | ||
local | local _commonHeaders = require("Module:Data tables/common").commonHeaders | ||
-- Builds table formatted for command pods | -- Builds table formatted for command pods | ||
function p. | function p.podTable(args) | ||
local category = args[1] | local category = args[1] | ||
local family = args[2] | local family = args[2] | ||
local json = mw.loadJsonData("GameData:Collections/parts") | |||
local cells = '' | |||
-- adds command module values | -- adds command module values | ||
local | local headers = _commonHeaders() .. | ||
"!Crew\n" .. | "!Crew\n" .. | ||
"!Electric Charge (U)\n" .. | "!Electric Charge (U)\n" .. | ||
"!Monopropellant (t)\n" .. | "!Monopropellant (t)\n" .. | ||
"!Torque (kN)\n" | "!Torque (kN)\n" | ||
for k, v in pairs(json[category][family]) do | for k, v in pairs(json[category][family]) do | ||
local partJson = mw.loadJsonData(" | local partJson = mw.loadJsonData("GameData:"..k) | ||
local tempCell = | local tempCell = _commonCells(partJson) .. | ||
"|"..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 30: | Line 26: | ||
cells = tempCell..cells | cells = tempCell..cells | ||
end | end | ||
-- 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 podTab = headers..cells.."|}" | ||
return | return podTab | ||
end | end | ||
return p | return p |
Latest revision as of 05:28, 14 February 2025
Documentation for this module may be created at Module:Data tables/pods/doc
local p = {}
local _commonCells = require("Module:Data tables/common").commonCells
local _commonHeaders = require("Module:Data tables/common").commonHeaders
-- Builds table formatted for command pods
function p.podTable(args)
local category = args[1]
local family = args[2]
local json = mw.loadJsonData("GameData:Collections/parts")
local cells = ''
-- adds command module values
local headers = _commonHeaders() ..
"!Crew\n" ..
"!Electric Charge (U)\n" ..
"!Monopropellant (t)\n" ..
"!Torque (kN)\n"
for k, v in pairs(json[category][family]) do
local partJson = mw.loadJsonData("GameData:"..k)
local tempCell = _commonCells(partJson) ..
"|"..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 podTab = headers..cells.."|}"
return podTab
end
return p