User Tools

Site Tools


class-info

Class Info

This is a table defining a custom class to be registered with the mod:registerClass() function.

{
    TypeName = "MY_TYPE_NAME",
    ParentType = "ASSET",
    Properties = {
        { Name = "Property1", Type = "string", Default = "SomeString" },
        { Name = "Property2", Type = "list<RESOURCE_QUANTITY_PAIR>" },
        { 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.
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 (i.e. string, integer, float, etc.) or based on any of the existing DATA or ASSET objects, as well as lists.
Default property type optional, the default value assigned to the property
Flags list<string> 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
class-info.txt · Last modified: 2026/02/23 17:59 by polymorphgames

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki