Editing Module:Test/doc

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
__NOEDITSECTION__
+
__NOTOC__ __NOEDITSECTION__
 
'''This module is used for development.'''
 
'''This module is used for development.'''
  
Line 13: Line 13:
  
 
=== query ===
 
=== query ===
<pre><nowiki>{{#invoke:Test|query|<def ID>[|...|][|tag|][|sibling=...]}}</nowiki></pre>
+
<hr>
  
 
The work-horse. Output varies based on use:
 
The work-horse. Output varies based on use:
: If only the <code><def ID></code> parameter is set, it will show the whole Def in the log.
 
 
: If simple values are queried it will return them.
 
: If simple values are queried it will return them.
 
: If lists are queried it will return nothing but call <code><nowiki>{{#vardefine}}</nowiki></code> on all the simple values within it. What got defined can be seen in the page's log.
 
: If lists are queried it will return nothing but call <code><nowiki>{{#vardefine}}</nowiki></code> on all the simple values within it. What got defined can be seen in the page's log.
  
Named parameters:
+
<pre><nowiki>{{#invoke:Test|query|<def ID>[|...|][|tag|][|sibling=...]}}</nowiki></pre>
 +
 
 +
'''Named parameters:'''
  
: <code><def ID></code>
+
<code><def ID></code>
  
:: This parameter identifies the Def so it is mandatory. It can take two forms, if both are defined then <code>defName</code> takes preference.
+
: This parameter identifies the Def so it is mandatory. It can take two forms:
  
::: <code>defName=<defName></code>
+
: <code>defName=<defName></code>
:::: <code><defName></code> <small>''(case sensitive)''</small> should be replaced with the actual defName of a Def.
+
:: <code><defName></code> <small>''(case sensitive)''</small> should be replaced with the actual defName of a Def.
  
::: <code>label=<label></code>
+
: <code>label=<label></code>
:::: <code><label></code> <small>''(case insensitive)''</small> should be replaced with the actual label of a Def.
+
:: <code><label></code> <small>''(case insensitive)''</small> should be replaced with the actual label of a Def.
  
: <code>[sibling=...]</code> <small>''(optional)''</small> <small>''(case sensitive)''</small>
+
<code>[sibling=...]</code> <small>''(optional)''</small> <small>''(case sensitive)''</small>
::: Allows querying for something if we know its sibling's value (works only for values at the moment).
+
: Allows querying for something if we know its sibling's value (works only for values at the moment).
  
Anonymous parameters:
+
'''Anonymous parameters:'''
  
: <code>[|...|]</code> <small>''(optional)''</small> <small>''(case sensitive)''</small>
+
<code>[|...|]</code> <small>''(optional)''</small> <small>''(case sensitive)''</small>
:: Anonymous paramaters before the last one (<code>[tag]</code>) are here to help uniquely identify it. If the <code>[tag]</code> is already unique within a Def tree, then these additional parameters are not needed.
+
: Anonymous paramaters before the last one (<code>[tag]</code>) are here to help uniquely identify it. If the <code>[tag]</code> is already unique within a Def tree, then these additional parameters are not needed.
  
: <code>[|tag|]</code> <small>''(optional)''</small> <small>''(case sensitive)''</small>
+
<code>[|tag|]</code> <small>''(optional)''</small> <small>''(case sensitive)''</small>
:: The final anonymous parameter defines what is to be queried.
+
: The final anonymous parameter defines what is to be queried.
  
 
=== count ===
 
=== count ===
<pre><nowiki>{{#invoke:Test|count|<def ID>[|...|][|tag|][|sibling=...]}}</nowiki></pre>
+
<hr>
 +
 
 +
<pre><nowiki>{{#invoke:Test|count|<def ID>|[...|...|...]|[tag]|[sibling=...]}}</nowiki></pre>
  
 
Parameters are the same as for <code>query</code>. It's basically a wrapped up query that behaves a bit differently.
 
Parameters are the same as for <code>query</code>. It's basically a wrapped up query that behaves a bit differently.
Line 55: Line 58:
  
 
<code><nowiki>{{#invoke:Test|query|label=desert}}</nowiki></code>
 
<code><nowiki>{{#invoke:Test|query|label=desert}}</nowiki></code>
 
+
{{#invoke:Test|query|label=desert}}
<code>{{#invoke:Test|query|label=desert}}</code>
+
''(check the log)''
 
 
Data is in the log.
 
  
 
=== Retrieve a simple value ===
 
=== Retrieve a simple value ===
Line 113: Line 114:
  
 
<code>{{#invoke:Test|query|label=guinea pig|minAge|sibling=AnimalAdult}}</code>
 
<code>{{#invoke:Test|query|label=guinea pig|minAge|sibling=AnimalAdult}}</code>
 
<includeonly>[[Category:Module]]</includeonly>
 
<noinclude>[[Category:Module documentation]]</noinclude>
 

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)