Jump to content

Mscr:System.Types.Type

From Ironworks Games Wiki

A struct that contains the Type information for an Object in MarsScript.

You can retrieve the Type information from an object by using the typeof keyword.

Types are global to the assembly, so no matter what Object you get the Type from, if the Objects are of the same type, they will be able to compare against each-other.

Details

struct System.Types.Type : Object
Aliased as: type
Object Type: class (Copy by Reference)
Inherits From: System.Types.Object

Public Methods

GetAttribute

ref T GetAttribute<:T:>()
Generic Argument: T The type of attribute you want to retrieve Returns: ref T The first requested attribute assigned to the Object, or null if not found.

This method allows you to get the first Attribute of a particular type from this Type. Note that this is an attribute on the Object declaration, not on an instance.

If you want to get multiple Attributes, use #GetAttributes instead. If you just want to check if an attribute exists and don't need to use it for anything, use #HasAttribute instead.

GetAttributes

System.External.Array<:T:> GetAttributes<:T:>()
Generic Argument: T The type of attributes you want to retrieve Returns: System.External.Array<:T:> An external array containing all of the Attributes found on the Object declaration.

This method allows you to get all of the Attributes of a particular type from this Type. Note that this is an attribute on the class/struct declaration, not on an instance.

Note that this is significantly more resource-intensive than #GetAttribute. If you don't specifically need to account for multiple attributes of the same type, use that instead.

HasAttribute

bool HasAttribute<:T:>()
Generic Argument: T The type of attribute you want to check Returns: ref T true if any attribute of T is found on the declaration, false if otherwise.

If you only want to check for the existence of an attribute, but don't need to do any further work with it, this is the best option.

ToString

virtual string ToString()
Returns: System.Types.String A string representing the fully qualified Type path

Operators

operator== (Equal)

bool operator ==(Type a, Type b)

Returns true if both operand `a` and operand `b` are the same Type.

operator!= (Not Equal)

bool operator !=(Type a, Type b)

Returns true if operand `a` and operand `b` are NOT the same Type.