Difference between revisions of "TyD"
| (2 intermediate revisions by the same user not shown) | |||
| Line 12: | Line 12: | ||
==Example== | ==Example== | ||
'''Table''' | '''Table''' | ||
| − | { | + | {<span style="color:green">#I'm a comment</span> |
| − | '''Record''' | + | '''Record''' <span style="color:blue">SimpleValueWithoutSpacesOrBrackets</span> |
| − | '''Record2''' "Quoted string" | + | '''Record2''' <span style="color:blue">"Quoted string"</span> <span style="color:green">#Quoted strings can span multiple lines</span> |
| − | '''Record3''' 5.6 | + | '''Record3''' <span style="color:blue">5.6</span> <span style="color:green">#This is a simple number value</span> |
| − | '''Record4''' null | + | '''Record4''' <span style="color:blue">null</span> <span style="color:green">#TyD recognizes null values</span> |
| − | '''List''' [ very ; simple; list ] | + | '''List''' [ <span style="color:blue">very</span> ; <span style="color:blue">simple</span>; <span style="color:blue">list</span> ] |
'''List2''' | '''List2''' | ||
[ | [ | ||
| − | "Multi line" | + | <span style="color:blue">"Multi line"</span> <span style="color:green">#Remember to escape quotes in a quoted string like this \"</span> |
| − | "List" | + | <span style="color:blue">"List"</span> |
| − | ] | + | ] <span style="color:green">#Lists can also have numbers</span> |
'''ListOfTables''' | '''ListOfTables''' | ||
[ | [ | ||
{ | { | ||
| − | '''Record''' "This is an anonymous table, since elements in lists can't have names" | + | '''Record''' <span style="color:blue">"This is an anonymous table, since elements in lists can't have names"</span> |
} | } | ||
{ | { | ||
| − | '''Record''' "Here's another table" | + | '''Record''' <span style="color:blue">"Here's another table"</span> |
} | } | ||
] | ] | ||
| − | '''SubTable''' | + | '''SubTable''' { '''Record''' <span style="color:blue">"I heard you like tables"</span>; '''Record2''' <span style="color:blue">"So we put etc. etc."</span> } |
| − | |||
| − | |||
| − | |||
} | } | ||
Latest revision as of 16:09, 3 February 2020
TyD (Tynan's Tidy Data Language) is an open source data language created by Tynan Sylvester, to improve the layout of game-oriented data. You can read the official specification here.
Quick overview
Values in TyD can be simple_values, “quoted strings”, numbers, lists, tables or null. Values can be given a name, making them a record of name/value. You can make a table using curly brackets, and putting a list of records in it, separated by new lines or semicolons, e.g.
{
Name "Troll"
Health 10
}
You can also make a list using square brackets, and putting a list of values (not records), separated by new lines or semicolons, e.g.
[ 1; 2; 3 ]
You can put lists in tables and tables in lists, but note that when you put a table in a list, it shouldn’t have a name (since it’s not a record). A TyD Document should contain a list of records. Most TyD documents in Software Inc. contain a single table record. Localizations contain a list of string records.
Example
Table
{#I'm a comment
Record SimpleValueWithoutSpacesOrBrackets
Record2 "Quoted string" #Quoted strings can span multiple lines
Record3 5.6 #This is a simple number value
Record4 null #TyD recognizes null values
List [ very ; simple; list ]
List2
[
"Multi line" #Remember to escape quotes in a quoted string like this \"
"List"
] #Lists can also have numbers
ListOfTables
[
{
Record "This is an anonymous table, since elements in lists can't have names"
}
{
Record "Here's another table"
}
]
SubTable { Record "I heard you like tables"; Record2 "So we put etc. etc." }
}
In Software Inc.
Software Inc. uses a fork of Tynan’s C# implementation of TyD, which you can find here. If you want to know why Software Inc. switched from XML to TyD, and not something else, you should read the comparison section of the TyD specification. Other than the reasons listed, TyD resembled C# a lot, which reduces friction during development and I would rather not rely on a third party closed-source solution when parsing data.