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 key with exact name. Attributes become subkeys. A bit ugly but simple. | |
− | |||
− | |||
− | |||
− | + | === 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 88: | Line 67: | ||
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. | ||
− | === | + | === <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> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Issues == | == Issues == | ||
− | + | * One data file or smaller ones split by categories (buildings, races, items, etc.). | |
− | One data file or smaller ones split by categories (buildings, races, items, etc.). | + | * A pro for separation might be that not everything has to be loaded to get relevant data (load only relevant files). |
− | + | * Until a more final version of the data is seen, the size of the whole thing is a bit unknown but shouldn't be too big to prevent the "one file" option. A definite pro for the one file option is the simplicity of updating - upload one file, done. | |
− | + | * Some pieces of the puzzle are in game code so until more files are processed, can't say what else will pop up. | |
− | * | + | * Can't keep semi-manually processing the xml files... it's lunacy. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | * | ||
− | |||
− | |||
− |