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

Module:Data/doc: Difference between revisions

From Kerbal Space Program 2 Wiki
(Format fixes)
Tag: 2017 source edit
(Updated example content)
Tag: 2017 source edit
Line 4: Line 4:
<code><1></code> (Subject): This argument is taken as the title of the intended Data: page to search through.
<code><1></code> (Subject): This argument is taken as the title of the intended Data: page to search through.


<code><2+></code> (Parameter chain): Arguments 2, 3, 4, and so on define the parameter chain to search on the data page.
<code><2+></code> (Parameter chain): Arguments 2 and beyond define the parameter chain to search on the data page.


== Functions ==
== Functions ==
Line 10: Line 10:


== Examples ==
== Examples ==
<code><LV-SW_"SWERV"><mass></code> - Returns the mass of the "SWERV", <code>4.000</code>.
An example populated JSON set can be found at [[Data:Example]], and blank at [[Data:Example/blank]].


<code><LV-3000_"Tuba"><modules><engine><thrust><vac></code> - Returns the vacuum thrust of the "Tuba", <code>510.0</code>.
<code><nowiki>{{#invoke:Data|getData|LV-SW "SWERV"|mass}}</nowiki></code> - Returns the mass of the "SWERV", <code>4.000</code>.
 
<code><nowiki>{{#invoke:Data|getData|LV-3000 "Tuba"|modules|engine|thrust|vac}}</nowiki></code> - Returns the vacuum thrust of the "Tuba", <code>510.0</code>.

Revision as of 16:24, 12 October 2024

The Data module exists to translate information from Data: pages to templates/articles.

Arguments

<1> (Subject): This argument is taken as the title of the intended Data: page to search through.

<2+> (Parameter chain): Arguments 2 and beyond define the parameter chain to search on the data page.

Functions

getData: The primary function of the module. Accepts the full argument set to determine the parameter to return from the subject.

Examples

An example populated JSON set can be found at Data:Example, and blank at Data:Example/blank.

{{#invoke:Data|getData|LV-SW "SWERV"|mass}} - Returns the mass of the "SWERV", 4.000.

{{#invoke:Data|getData|LV-3000 "Tuba"|modules|engine|thrust|vac}} - Returns the vacuum thrust of the "Tuba", 510.0.

MediaWiki Appliance - Powered by TurnKey Linux