CRect:Get


The Get method returns the properties the describe the 4 dimensions of the CRect object.

Syntax

nXmin, nXmax, nYmin, nYmax = CRect:Get()

bullet.gif    On success, this method returns 4 numbers.

bullet.gif    On failure, this method returns 0, 0, 0, 0.

Example

Example 1: The following script retrieves the 4 dimensions of the CRect and prints the values.

R = new_rect()

-- create a CRect object

R:Set(100,200,40.5,300.25)

-- specify the dimensions

x1, x2, y1, y2 = R:Get()

-- return the CRect dimensions

Printf("%lg:%lg,%lg:%lg\n",x1,x2,y1,y2)

-- result: 100:200, 40.5:300.25

R:delete()

-- when done with R, remove from memory

Example 2: The example below shows a more compact coding that gives the same result. Here we pass only Get to print all 4 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.

R = new_rect()

-- create a CRect object

R:Set( 100, 200, 40,5, 300.25 )

-- specify the dimensions

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

-- result: 100:200, 40.5:300.25. See comment above.

R:delete()

-- when done with R, remove it from memory

Related Topics

CRect class, Set


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.