CPoint:new
The new method constructs a new instance of a CPoint object. You must call this method before using the class. Note that the object can also be created using new_point.
P = CPoint:new() P = CPoint:new( x0 ) P = CPoint:new( x0, y0 ) P = CPoint:new( CPoint_old ) P = CPoint:new( CRect_old ) P = CPoint:new( tbl ) WIth no parameters, this method creates a CPoint object, assigns x=0 and y=0, and returns the new object. x0 is a single number for initializing both the x and y class members. y0 is the second number, which initializes the class x and y to x0 and y0. CPoint_old is an existing CPoint object. CRect_old is an existing CRect object. The class member x is inialized to the rectangle width and y is initialized to the rectangle height. tbl is a 1-dimensional array with values that are numbers. with 2 numbers at index 1 and index 2. The class property x is initialized to tbl[1] and the class property y is initalized to tbl[2]. P is returned as a new instance of the CPoint class. On failure, nil is returned. |
The following script creates various CPoint objects.
|
-- create a CPoint object |
|
-- set the values for point members x and y |
|
-- create a CPoint object with intial values |
|
-- create a new rectangle object |
|
-- add the rectangle width and height to P1 and add 2 |
CPoint class, delete, new_point
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.