Editing Module:Test/data/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:
 
== Transformation rules ==
 
== Transformation rules ==
 
=== RimWorld version ===
 
Version is added to the beginning of each generated Lua table.
 
 
<pre>
 
return {
 
 
  version = "1.2.2753",
 
  ...
 
</pre>
 
  
 
=== Elements with attributes ===
 
=== Elements with attributes ===
Line 17: Line 7:
 
<defName> is used as part of the index for the main Def table.
 
<defName> is used as part of the index for the main Def table.
  
Additional attributes added: "DLC", "FileName".
+
Additional meta elements added.
  
 
<pre>
 
<pre>
Line 26: Line 16:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 33: Line 23:
 
     ["ParentName"] = "BaseHare",
 
     ["ParentName"] = "BaseHare",
 
     ["FileName"] = "Races_Animal_Hares.xml",
 
     ["FileName"] = "Races_Animal_Hares.xml",
 +
    ["Version"] = "1.2.2753 rev705",
 
     ["DLC"] = "Core",
 
     ["DLC"] = "Core",
 
   },
 
   },
Line 40: Line 31:
 
</pre>
 
</pre>
  
Parent (abstract) Def:
+
Parent (absctact) Def that gets inherited:
  
 
<pre>
 
<pre>
Line 50: Line 41:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 59: Line 50:
 
     ["Name"] = "BaseHare",
 
     ["Name"] = "BaseHare",
 
     ["FileName"] = "Races_Animal_Hares.xml",
 
     ["FileName"] = "Races_Animal_Hares.xml",
 +
    ["Version"] = "1.2.2753 rev705",
 
     ["DLC"] = "Core",
 
     ["DLC"] = "Core",
 
   },
 
   },
Line 67: Line 59:
 
</pre>
 
</pre>
  
=== List elements without children ===
+
=== Descriptions ===
 +
 
 +
Because of some exceptions in Royalty Defs, <description> content has to be wrapped in double square brackets (Lua multiline syntax).
 +
 
 +
=== <nowiki><li></nowiki> elements without children ===
 
Get transformed into ordered lists (numerically indexed Lua tables).
 
Get transformed into ordered lists (numerically indexed Lua tables).
  
Line 77: Line 73:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 88: Line 84:
 
Note: a comma after the last item in a list is not flagged as an error in Lua.
 
Note: a comma after the last item in a list is not flagged as an error in Lua.
  
=== List elements with children ===
+
=== <nowiki><li></nowiki> elements with children ===
  
 
<pre>
 
<pre>
Line 107: Line 103:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 125: Line 121:
 
},
 
},
 
</pre>
 
</pre>
 
=== List elements with a single attribute Class ===
 
The value of the "Class" attribute is used to rename the <nowiki><li></nowiki>.
 
 
<pre>
 
<comps>
 
  <li Class="CompProperties_Glower">
 
    <glowRadius>10</glowRadius>
 
...
 
</pre>
 
 
transforms to:
 
 
<pre>
 
comps = {
 
  CompProperties_Glower = {
 
    glowRadius = 10,
 
...
 
</pre>
 
 
=== Components ===
 
 
It would be useful to have some of the more used components. They can then be queried for additional functionality that some game objects have.
 
 
They can be numbered tables or, as in some of the examples above, string indexed. String indexes, in general, are simpler to use. Numeric tables I have to search through.
 
 
See [[#List elements with a single attribute Class]]
 
  
 
=== Ranges (1~2) ===
 
=== Ranges (1~2) ===
<pre><overdoseSeverityOffset>0.18~0.35</overdoseSeverityOffset></pre>
+
: TODO
transforms to:
 
<pre>overdoseSeverityOffset = { ["<"]=0.18, [">"]=0.35 },</pre>
 
  
 
=== Curve points ===
 
=== Curve points ===
Line 174: Line 141:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 187: Line 154:
 
</pre>
 
</pre>
  
=== Descriptions ===
+
=== Components ===
 +
 
 +
It would be useful to have some of the more used components. They can then be queried for additional functionality that some game objects have.
  
Because of some exceptions in Royalty Defs, <description> content has to be wrapped in double square brackets (Lua multiline syntax).
+
They can be numbered tables or, as in some of the examples above, string indexed. String indexes, in general, are simpler to use. Numeric tables I have to search through.
  
=== MayRequire attribute ===
+
TODO: filtering syntax
Removed.
 
  
 
== Issues ==
 
== Issues ==
Line 209: Line 177:
 
=== Inheritance (interaction with parser) ===
 
=== Inheritance (interaction with parser) ===
 
Inheritance can be handled by the parser or the module. If the parser handles it, then for any change the dataset needs to be recreated so I'm leaning towards letting the module take care of that. In this case the only purpose of the parser is to filter data and transform it into something Lua can use.
 
Inheritance can be handled by the parser or the module. If the parser handles it, then for any change the dataset needs to be recreated so I'm leaning towards letting the module take care of that. In this case the only purpose of the parser is to filter data and transform it into something Lua can use.
 
== TODO ==
 
* Implement filtering for components (any list item that follows the same pattern)
 
 
<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)