Skip to main content

Size

Description:

  A size object with a given width and height.

Class Object: Size Class.

Inherits from: ContainerItem.

width

Type: Field.

Description:

  The width of the size.

Signature:

width: number

height

Type: Field.

Description:

  The height of the size.

Signature:

height: number

set

Type: Function.

Description:

  Set the width and height of the size.

Signature:

set: function(self: Size, width: number, height: number)

Parameters:

ParameterTypeDescription
widthnumberThe new width of the size.
heightnumberThe new height of the size.

equals

Type: Function.

Description:

  Check if two sizes are equal.

Signature:

equals: function(self: Size, other: Size): boolean

Usage:

sizeA == sizeB or sizeC ~= sizeD

Parameters:

ParameterTypeDescription
otherSizeThe other size to compare to.

Returns:

Return TypeDescription
booleanWhether or not the two sizes are equal.

mul

Type: Function.

Description:

  Multiply the size by a vector.

Signature:

mul: function(self: Size, vec: Dora.Vec2.Type): Size

Usage:

local halfSize = size * Vec2(0.5, 0.5)

Parameters:

ParameterTypeDescription
vecVec2The vector to multiply by.

Returns:

Return TypeDescription
SizeThe result of multiplying the size by the vector.

__eq

Type: Metamethod.

Description:

  Check if two sizes are equal.

Signature:

metamethod __eq: function(self: Size, other: Size): boolean

Usage:

sizeA == sizeB or sizeC ~= sizeD

Parameters:

ParameterTypeDescription
otherSizeThe other size to compare to.

Returns:

Return TypeDescription
booleanWhether or not the two sizes are equal.

__mul

Type: Metamethod.

Description:

  Multiply the size by a vector.

Signature:

metamethod __mul: function(self: Size, vec: Dora.Vec2.Type): Size

Usage:

local halfSize = size * Vec2(0.5, 0.5)

Parameters:

ParameterTypeDescription
vecVec2The vector to multiply by.

Returns:

Return TypeDescription
SizeThe result of multiplying the size by the vector.