Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Infobox parts: Difference between revisions

From Kerbal Space Program 2 Wiki
(args change)
(saving current work, some module iteration)
 
Line 2: Line 2:
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs


function p._buildInfobox(frame)
function p._buildInfobox(args)
local args = getArgs(frame)
--local args = getArgs(frame)
page = args[1]
page = args[1]
-- load the full parts list to iterate per given category and family
-- load the full parts list to iterate per module
--json = mw.loadJsonData("Data:Collections/parts")
json = mw.loadJsonData("Data:"..page)
boxes = ""
-- each applicable part's data is appended to the table cells
-- each applicable part's data is appended to the table cells
--for k, v in pairs(json[category][family]) do
for k, v in pairs(json["modules"]) do
-- local partJson = mw.loadJsonData("Data:"..k)
-- local tempCell = p._commonCells(partJson)
if k == "engine" then
-- cells = tempCell..cells
boxes = boxes.."{{Infobox engines/doc}}"
--end
end
end
-- append the cells to the headers and cap off the table wiki text
mw.logObject(boxes)
--local tempTable = header..cells.."|}"
 
return page
return page
end
end

Latest revision as of 23:28, 22 December 2024

Documentation for this module may be created at Module:Infobox parts/doc

local p = {}
local getArgs = require('Module:Arguments').getArgs

function p._buildInfobox(args)
	--local args = getArgs(frame)
	page = args[1]
	-- load the full parts list to iterate per module
	json = mw.loadJsonData("Data:"..page)
	boxes = ""
	
	-- each applicable part's data is appended to the table cells
	for k, v in pairs(json["modules"]) do
		
		if k == "engine" then
			boxes = boxes.."{{Infobox engines/doc}}"
		end
	end
	mw.logObject(boxes)

	return page
end


return p
MediaWiki Appliance - Powered by TurnKey Linux