CRect:Get
The Get method returns the 4 dimension values of the CRect object.
xmin, xmax, ymin, ymax = CRect:Get() |
xmin, xmax, ymin, ymax are the rectangle properties. On failure, 0,0,0,0 are returned.
Example 1: The following script retrieves the 4 dimensions of the CRect and prints the values.
|
-- create a CRect object |
|
-- return the CRect dimensions |
|
-- result: 100:200, 40.5:300.25 |
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.
|
-- create a CRect object |
|
-- result: 100:200, 40.5:300.25 |