Module:Data tables/pods: Difference between revisions

From Kerbal Space Program 2 Wiki
Jump to navigation Jump to search
further extraction
change cells to function
Tag: Reverted
Line 13: Line 13:
"!Torque (kN)\n"
"!Torque (kN)\n"
local cells =
function cells(partJson)
local podCells =
"|"..partJson["modules"]["command_module"]["crew_capacity"].."\n" ..
"|"..partJson["modules"]["command_module"]["crew_capacity"].."\n" ..
"|"..partJson["resources"]["electric_charge"].."\n" ..
"|"..partJson["resources"]["electric_charge"].."\n" ..
"|"..partJson["resources"]["monopropellant"].."\n" ..
"|"..partJson["resources"]["monopropellant"].."\n" ..
"|"..partJson["modules"]["reaction_wheel"]["torque"]["pitch"].."\n"
"|"..partJson["modules"]["reaction_wheel"]["torque"]["pitch"].."\n"
return podCells
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 headerCells = {header, cells}
local headerCells = {header, cells()}
return headerCells
return headerCells
end
end


return p
return p

Revision as of 05:39, 1 February 2025

Documentation for this module may be created at Module:Data tables/pods/doc

local p = {}

-- 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"
	
	function cells(partJson)
		local podCells =
			"|"..partJson["modules"]["command_module"]["crew_capacity"].."\n" ..
			"|"..partJson["resources"]["electric_charge"].."\n" ..
			"|"..partJson["resources"]["monopropellant"].."\n" ..
			"|"..partJson["modules"]["reaction_wheel"]["torque"]["pitch"].."\n"
		return podCells
	end
	
	-- append the cells to the headers and cap off the table wiki text
	local headerCells = {header, cells()}
	return headerCells
end

return p