orientation module

Functions for working with orientations.

Usage

local orientation = require('__flib__.orientation')

Functions

to_direction(orientation[, eight_way=false]) Returns a 4way or 8way direction from an orientation.
opposite(orientation) Returns the opposite orientation.
add(orientation1, orientation2) Add two orientations together.

Fields

north north orientation
east east orientation
west west orientation
south south orientation
northeast northeast orientation
northwest northwest orientation
southeast southeast orientation
southwest southwest orientation

Functions

# to_direction(orientation[, eight_way=false])

Returns a 4way or 8way direction from an orientation.

Parameters: Returns:
# opposite(orientation)

Returns the opposite orientation.

Parameters: Returns:
  • (number) the opposite orientation
# add(orientation1, orientation2)

Add two orientations together.

Parameters: Returns:
  • (number) the orientations added together

Fields

# north

north orientation

# east

east orientation

# west

west orientation

# south

south orientation

# northeast

northeast orientation

# northwest

northwest orientation

# southeast

southeast orientation

# southwest

southwest orientation