CPoint:Set


The Set method sets both the x and y properties of the CPoint. To set only one property, use the property directly, like P.x or P.y.

Syntax

CPoint:Set( x, y )

CPoint:Set( v )

CPoint:Set( CPoint2 )

CPoint:Set( CRect )

CPoint:Set( array )

where

    x, y are numbers that are copied to the x and y properties.

    v is a single value that will be assigned to both the x and y properties.

    CPoint2 is an existing CPoint object whose x and y proerties will be copied.

    CRect is a CRect object whose size (width and height) will be assigned to the x and y properties.

    array is a lua table containing at least elements [1] and[2], which will be assigned in order to the x and y properties.

Example

The following script initializes the x and y values of the CPoint to x=100, y=300.25:

P = NewPoint()

-- create a CPoint object

  --

-- do other operations

P:Set(100,300.25)

-- set the CPoint to new values

Related Topics

Get

NewPoint

CPoint class

Image Coordinate System

Subpixel Coordinate Definition