Inspect data types.

The _type() is a versatile method that can be used to inspect object type. This method is particularly useful for scripts that rely on the type to return a certain value or perform a specific task. The _type() method supports a wide range of data types, including string, integer, boolean, float, color, table, line, label, box, linefill, array<type>, and matrix<type>. By leveraging the _type() method, Pinescript users can create more robust and flexible scripts that can adapt to a wide range of data inputs.

// Example testing object types 

varStr = "Hello"
varStr._type() // returns "string".

varFlt = 1.25
varFlt._type() // returns "float".

int varInt = 100
varInt._type() // returns "int".

bool varBool = true
varBool._type() // returns "bool".

color varClr = color.red
varClr._type() // returns "color".

table varTbl = table.new(position, col, row)
varTbl._type() // returns "table".

array<string> varArrS = array.new_string(5,na)
varArrS._type() // returns "array<string>".

matrix<float> varMtxF = matrix.new<float>(4,4,0.5)
varMtxF._type() // returns "matrix<float>".