Home Contents | # Rectangle Positions | Graphics | Core4 Lua Commands

## SYNOPSIS

1. x = rect:x()
2. y = rect:y()
3. y1 = rect:top()
4. y2 = rect:bottom()
5. x1 = rect:left()
6. x2 = rect:right()
7. x1, y1 = rect:topleft()
8. x2, y2 = rect:bottomright()

## DESCRIPTION

A group of functions for querying the corner coordinates of a rectangle.

rect:x(), rect:left() | Returns the left x-coordinate of the rectangle.
rect:right() | Returns the right x-coordinate of the rectangle.
rect:y(), rect:top() | Returns the top y-coordinate of the rectangle.
rect:bottom() | Returns the bottom y-coordinate of the rectangle.
rect:topleft() | Returns the top-left x, y coordinate pair.
rect:bottomright() | Returns the bottom-right x, y coordinate pair.

## ERRORS

Raises an error if rect is not a rectangle.

## EXAMPLE

> >
r = gfx.rect(10,20,30,40) print(r.topleft())
10 20
>
print(r.bottomright())
39 59

## SEE ALSO

gfx.rect, rect(), rect:height, rect:size, rect:width, rect:contains, tostring(rect)