CPoint:new
The new method constructs a new instance of a CPoint object. The CPoint class includes 2 properties that describe the x and y values of a point. You can treat this object as a classic point or you can use it simply to hold 2 numbers. Using this class method is equivalent to using the global function NewPoint.
P = CPoint:new() P = CPoint:new( CPointOld ) P = CPoint:new( x, y ) P = CPoint:new( x ) P = CPoint:new( CRect ) P = CPoint:new( array ) where
|
The following script illustrates using various forms of new. All produce the same result:
|
-- create CPoint A and set values |
|
-- result: 100 300 |
|
|
|
-- copy CPoint A to a new CPoint B |
|
-- result: 100 300 |
|
|
|
-- create a default CPoint C |
|
|
|
-- result: 100 300 |