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: | ||
− | == | + | == Herein lie the (current) ad hoc rules for getting from an XML to a Lua table == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Elements with attributes === | === Elements with attributes === | ||
− | + | Move into subkey with exact name. | |
− | |||
− | |||
− | |||
− | + | === Def keys === | |
+ | defName is used as an index for the main Def table. defName remains as a subkey to the table. | ||
<pre> | <pre> | ||
Line 26: | Line 14: | ||
</pre> | </pre> | ||
− | + | becomes | |
<pre> | <pre> | ||
− | [" | + | ["Hare"] = { |
− | + | ["ParentName"] = "BaseHare", | |
− | + | ["defName"] = "Hare", | |
− | + | ["label"] = "hare", | |
− | |||
− | |||
− | ["defName"] = " | ||
− | ["label"] = " | ||
... | ... | ||
</pre> | </pre> | ||
− | Parent ( | + | Parent Def that gets inherited (Name becomes the key, no defName): |
<pre> | <pre> | ||
Line 50: | Line 34: | ||
</pre> | </pre> | ||
− | + | becomes | |
<pre> | <pre> | ||
− | [" | + | ["BaseHare"] = { |
− | + | ["Abstract"] = true, | |
− | + | ["ParentName"] = "AnimalThingBase", | |
− | + | ["statBases"] = { | |
− | + | ["MoveSpeed"] = 6.0, | |
− | + | ["MarketValue"] = 50, | |
− | + | ... | |
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
− | === | + | === <nowiki><li></nowiki> elements enclosing simple values === |
Get transformed into ordered lists (numerically indexed Lua tables). | Get transformed into ordered lists (numerically indexed Lua tables). | ||
Line 77: | Line 56: | ||
</pre> | </pre> | ||
− | + | becomes | |
<pre> | <pre> | ||
Line 86: | Line 65: | ||
</pre> | </pre> | ||
− | Note: | + | Note: an extra comma after the last item in a list is not flagged as an error in Lua. |
− | === | + | === <nowiki><li></nowiki> elements enclosing multiple items === |
<pre> | <pre> | ||
Line 107: | Line 86: | ||
</pre> | </pre> | ||
− | + | becomes | |
<pre> | <pre> | ||
Line 125: | Line 104: | ||
}, | }, | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Ranges (1~2) === | === Ranges (1~2) === | ||
− | + | : TODO | |
− | |||
− | |||
=== Curve points === | === Curve points === | ||
− | |||
− | |||
− | |||
− | |||
− | |||
<pre> | <pre> | ||
<litterSizeCurve> | <litterSizeCurve> | ||
Line 174: | Line 119: | ||
</pre> | </pre> | ||
− | + | becomes | |
<pre> | <pre> | ||
Line 186: | Line 131: | ||
}, | }, | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |