Changes

Jump to navigation Jump to search
712 bytes added ,  15:09, 3 February 2020
Line 3: Line 3:  
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.
 
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.
 
  <nowiki>{
 
  <nowiki>{
−
Name “Troll”
+
Name "Troll"
 
Health 10
 
Health 10
 
}</nowiki>
 
}</nowiki>
Line 9: Line 9:  
  <nowiki>[ 1; 2; 3 ]</nowiki>
 
  <nowiki>[ 1; 2; 3 ]</nowiki>
 
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.
 
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==
 
==Example==
−
  <nowiki>Table
+
  '''Table'''
−
{#I’m a comment
+
{<span style="color:green">#I'm a comment</span>
−
Record SimpleValue
+
'''Record''' <span style="color:blue">SimpleValueWithoutSpacesOrBrackets</span>
−
Record2 “Quoted string” #Quoted strings can span multiple lines
+
'''Record2''' <span style="color:blue">"Quoted string"</span> <span style="color:green">#Quoted strings can span multiple lines</span>
−
Record3 5.6 #This is a simple number value
+
'''Record3''' <span style="color:blue">5.6</span> <span style="color:green">#This is a simple number value</span>
−
Record4 null #TyD recognizes null values
+
'''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” #Remember to escape quotes in a quoted string like this \”
+
<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>
−
] #Lists can also have numbers
+
] <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> }
−
{
+
}
−
Record “I heard you like tables”
  −
}
  −
}</nowiki>
      
==In Software Inc.==
 
==In Software Inc.==
 
Software Inc. uses a fork of Tynan’s C# implementation of TyD, which you can find [https://github.com/khornel/TyDSharp here].
 
Software Inc. uses a fork of Tynan’s C# implementation of TyD, which you can find [https://github.com/khornel/TyDSharp here].
 
If you want to know why Software Inc. switched from XML to TyD, and not something else, [https://github.com/TynanSylvester/TyD#comparisons 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.
 
If you want to know why Software Inc. switched from XML to TyD, and not something else, [https://github.com/TynanSylvester/TyD#comparisons 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.

Navigation menu