====== Class Info ======
This is a table defining a custom class to be registered with the ''[[:mod-management-functions#registerClass|mod:registerClass()]]'' function.
{
TypeName = "MY_TYPE_NAME",
ParentType = "ASSET",
Properties = {
{ Name = "Property1", Type = "string", Default = "SomeString" },
{ Name = "Property2", Type = "list" },
{ Name = "Property3", Type = "integer", Default = 1, Flags = { "SAVE_GAME" } }
}
}
^ Name ^ Type ^ Description ^
| ''TypeName'' | ''string'' | the name of your type |
| ''ParentType'' | ''string'' | optional, the name of the parent type of your type\\ Can be a core type such as ''ASSET'', ''COMPONENT'', or any extendable type.\\ If this field is missing, the new type will be a basic data type. |
| ''[[:class-info#Properties|Properties]]'' | ''list'' | a list of the properties your type contains |
===== Properties =====
A list of the class properties. Each property is defined with a table with the following fields:
^ Name ^ Type ^ Description ^
| ''Name'' | ''string'' | the name of the property |
| ''Type'' | ''string'' | the type of the property.\\ You can define properties based on the basic [[data-types|data types]] (i.e. string, integer, float, etc.) or based on any of the existing [[api#data_classes|DATA]] or [[assets|ASSET]] objects, as well as ''list''s. |
| ''Default'' | property type | optional, the default value assigned to the property |
| ''[[:class-info#Property Flags|Flags]]'' | ''list'' | optional, additional flag for the property, such as ''SAVE_GAME'' or ''ALLOW_NULL'' |
===== Property Flags =====
^ Name ^ Description ^
| ''SAVE_GAME'' | Flag the property as persistant across reload |
| ''ALLOW_NULL'' | Allow the property to be declared ''nil'' without triggering an error |