More actions
(Started documenting the module) Tag: 2017 source edit |
(moved some comment text from the module into the documentation) Tag: 2017 source edit |
||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Arguments == | == Arguments == | ||
<code><1></code> ( | <code><1></code> (Entity): This argument is taken as the title of the intended Data: page to search through. | ||
<code>2+</code> (Parameter chain): Arguments 2 | |||
E.g.: "Kerbol", "LW-Sw "SWERV"" | |||
<code><2+></code> (Parameter chain): Arguments 2 and beyond define the parameter chain to search on the data page. | |||
E.g.: "mass", "max_temp", "modules|engine|isp_vac", "modules|generator|outputs|units" | |||
== Functions == | == Functions == | ||
<code>getData</code>: The primary function of the module. Accepts the full argument set to determine the parameter to return from the subject. | <code>getData</code>: The primary function of the module. Accepts the full argument set to determine the parameter to return from the subject. | ||
<code>getFuelLabels</code>: Used for engine infobox construction. Accepts a part name (only works for engines) for <code><1></code> and optionally "alt" for <code><2></code>. Returns a line-break separated list of the propellant names used by an engine mode. ''Should probably be moved to a different Module.'' | |||
<code>getFuelValues</code>: Used for engine infobox construction. Accepts a part name (only works for engines) for <code><1></code> and optionally "alt" for <code><2></code>. Returns a line-break separated list of the propellant use rates of an engine mode. ''Should probably be moved to a different Module.'' | |||
== Examples == | == Examples == | ||
<LV- | A list of example JSON sets can be found at [[Data:Example]]. | ||
<LV- | |||
<code><nowiki>{{#invoke:Data|getData|LV-SW "SWERV"|mass}}</nowiki></code> - Returns the mass of the "SWERV" in tons, <code>{{#invoke:Data|getData|LV-SW "SWERV"|mass}}</code>. | |||
<code><nowiki>{{#invoke:Data|getData|LV-3000 "Tuba"|modules|engine|thrust|vac}}</nowiki></code> - Returns the vacuum thrust of the "Tuba" in kilonewtons, <code>510.0</code>. |
Latest revision as of 19:39, 6 December 2024
The Data module exists to translate information from Data: pages to templates/articles.
Arguments[edit source]
<1>
(Entity): This argument is taken as the title of the intended Data: page to search through.
E.g.: "Kerbol", "LW-Sw "SWERV""
<2+>
(Parameter chain): Arguments 2 and beyond define the parameter chain to search on the data page.
E.g.: "mass", "max_temp", "modules|engine|isp_vac", "modules|generator|outputs|units"
Functions[edit source]
getData
: The primary function of the module. Accepts the full argument set to determine the parameter to return from the subject.
getFuelLabels
: Used for engine infobox construction. Accepts a part name (only works for engines) for <1>
and optionally "alt" for <2>
. Returns a line-break separated list of the propellant names used by an engine mode. Should probably be moved to a different Module.
getFuelValues
: Used for engine infobox construction. Accepts a part name (only works for engines) for <1>
and optionally "alt" for <2>
. Returns a line-break separated list of the propellant use rates of an engine mode. Should probably be moved to a different Module.
Examples[edit source]
A list of example JSON sets can be found at Data:Example.
{{#invoke:Data|getData|LV-SW "SWERV"|mass}}
- Returns the mass of the "SWERV" in tons, 10.00
.
{{#invoke:Data|getData|LV-3000 "Tuba"|modules|engine|thrust|vac}}
- Returns the vacuum thrust of the "Tuba" in kilonewtons, 510.0
.