Skip to content

Variant

Variant is a container for the build in OPC-UA datatypes. It is used to hold the values for the input and output values of a MethodNode's method.

Functions

Variant.new()

Creates a new Variant instance

Returns: Variant new instance

Methods

Variant:isEmpty()

Checks if the Variant has no value defined

Returns: boolean true if there is no value defined

Variant:isScalar()

Checks if the Variant contains a scalar value

Returns: boolean true if the variant contains a scalar value

Variant:hasScalarType(type)

Checks if a Variant contains a scalar value of the given type

Params

Returns: boolean true if the variant contains a scalar value of the given type

Variant:hasArrayType()

Checks if a Variant contains an array of the given type

Params

Returns: boolean true if the variant contains an array of the given type

Variant:setScalar(value, data_type)

Set the variant to a scalar value

Params

  • value

    • string|number|boolean
    • The scalar value
  • type

Variant:setArray()

Set the variant to an array

Params

  • value

    • string[]|number[]|boolean[]
    • array of values
  • type

Variant:getScalar()

Get the value of a scalar variant

Returns: string|number|boolean the variants scalar value

Variant:getArray()

Get the value of an array variant

Returns: string[]|number[]|boolean[] the variant's array

Back to top