CPoint:Get


The Get method returns the x and y properties of the CPoint object.

Syntax

x, y = CPoint:Get()

    On success, this method returns 2 numbers. On failure, 0,0. is returned.

Example

Example 1: The following script retrieves the x and y values of the CPoint and prints the values.

P = NewPoint(100,200)

-- create a CPoint object

x, y = P:Get()

-- return the CPoint values

Printf("%lg %lg\n",x,y)

-- result: 100 200

Example 2: The example below shows a more compact coding that gives the same result. Here we pass only Get to print both returned values. This works because multiple return values can be passed into another function only for the last parameter in the call list. For all but the last passed argument, only the first returned value is used by Lua. If there were another argument in the Printf following Get, this shortcut would not work.

P = NewPoint(100,200)

-- create a CPoint object

Printf("%lg %lg\n", P:Get() )

-- result: 100 200

Related Topics

Set

CPoint class