Difference between revisions of "TyD"

From Software Inc.
Jump to navigation Jump to search
 
Line 32: Line 32:
 
  }
 
  }
 
  ]
 
  ]
  '''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''' <span style="color:blue">"I heard you like tables"</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.