<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://edfieldmanual.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ASRVs</id>
	<title>Module:SRVs - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://edfieldmanual.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ASRVs"/>
	<link rel="alternate" type="text/html" href="https://edfieldmanual.com/index.php?title=Module:SRVs&amp;action=history"/>
	<updated>2026-08-29T17:15:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://edfieldmanual.com/index.php?title=Module:SRVs&amp;diff=2573&amp;oldid=prev</id>
		<title>Sythan: Create structured SRV infobox module</title>
		<link rel="alternate" type="text/html" href="https://edfieldmanual.com/index.php?title=Module:SRVs&amp;diff=2573&amp;oldid=prev"/>
		<updated>2026-08-29T13:33:03Z</updated>

		<summary type="html">&lt;p&gt;Create structured SRV infobox module&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module:SRVs&lt;br /&gt;
-- Structured Surface Recon Vehicle helpers.&lt;br /&gt;
-- Canonical SRV data lives in Module:Data/SRVs/&amp;lt;Name&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local FIELD_ORDER = {&lt;br /&gt;
	{ key = &amp;#039;manufacturer&amp;#039;, label = &amp;#039;Manufacturer&amp;#039;, group = &amp;#039;SRV&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;vehicle_type&amp;#039;, label = &amp;#039;Vehicle type&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;primary_role&amp;#039;, label = &amp;#039;Primary role&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;crew&amp;#039;, label = &amp;#039;Crew&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;hangar&amp;#039;, label = &amp;#039;Hangar requirement&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;release&amp;#039;, label = &amp;#039;Release&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;availability&amp;#039;, label = &amp;#039;Availability&amp;#039; },&lt;br /&gt;
&lt;br /&gt;
	{ key = &amp;#039;mass&amp;#039;, label = &amp;#039;Mass&amp;#039;, group = &amp;#039;SPECIFICATIONS&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;hull&amp;#039;, label = &amp;#039;Hull&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;shields&amp;#039;, label = &amp;#039;Shields&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;speed&amp;#039;, label = &amp;#039;Speed&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;boost_speed&amp;#039;, label = &amp;#039;Boost speed&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;cargo&amp;#039;, label = &amp;#039;Cargo&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;weapons&amp;#039;, label = &amp;#039;Weapons&amp;#039; },&lt;br /&gt;
	{ key = &amp;#039;utility_equipment&amp;#039;, label = &amp;#039;Utility equipment&amp;#039; },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function isNonEmpty(value)&lt;br /&gt;
	return value ~= nil and value ~= &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function dataTitleFor(name)&lt;br /&gt;
	return &amp;#039;Module:Data/SRVs/&amp;#039; .. name&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function loadRecord(name)&lt;br /&gt;
	local ok, data = pcall(mw.loadData, dataTitleFor(name))&lt;br /&gt;
	if ok and type(data) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		return data&lt;br /&gt;
	end&lt;br /&gt;
	return { name = name }&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function fmt(value)&lt;br /&gt;
	if not isNonEmpty(value) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	if type(value) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		if #value == 0 then&lt;br /&gt;
			return nil&lt;br /&gt;
		end&lt;br /&gt;
		return table.concat(value, &amp;#039;&amp;lt;br&amp;gt;&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	return tostring(value)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.infobox(frame)&lt;br /&gt;
	local parent = frame:getParent()&lt;br /&gt;
	local args = parent and parent.args or frame.args&lt;br /&gt;
	local title = mw.title.getCurrentTitle()&lt;br /&gt;
	local name = args.name or title.text&lt;br /&gt;
	local record = loadRecord(name)&lt;br /&gt;
&lt;br /&gt;
	local params = {&lt;br /&gt;
		name = args.name or record.name or name,&lt;br /&gt;
		image = args.image or record.image or &amp;#039;&amp;#039;,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	local row = 1&lt;br /&gt;
	for _, field in ipairs(FIELD_ORDER) do&lt;br /&gt;
		local value = record[field.key]&lt;br /&gt;
		if isNonEmpty(args[field.key]) then&lt;br /&gt;
			value = args[field.key]&lt;br /&gt;
		end&lt;br /&gt;
		value = fmt(value)&lt;br /&gt;
		if isNonEmpty(value) then&lt;br /&gt;
			if field.group then&lt;br /&gt;
				params[&amp;#039;group&amp;#039; .. row] = field.group&lt;br /&gt;
			end&lt;br /&gt;
			params[&amp;#039;label&amp;#039; .. row] = field.label&lt;br /&gt;
			params[&amp;#039;row&amp;#039; .. row] = value&lt;br /&gt;
			row = row + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate{ title = &amp;#039;Infobox&amp;#039;, args = params }&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Sythan</name></author>
	</entry>
</feed>