misc module

Miscellaneous control-stage functions that don’t yet have a proper home.

Usage

local misc = require("__flib__.misc")

Functions

get_distance(pos1, pos2) Calculate the distance in tiles between two positions.
get_distance_squared(pos1, pos2) Calculate the squared distance in tiles between two positions.
ticks_to_timestring([tick=game.ticks_played]) Convert given tick or game.tick into “[hh:]mm:ss” format.

Functions

# get_distance(pos1, pos2)

Calculate the distance in tiles between two positions.

Parameters: Returns:
# get_distance_squared(pos1, pos2)

Calculate the squared distance in tiles between two positions.

Parameters: Returns:
# ticks_to_timestring([tick=game.ticks_played])

Convert given tick or game.tick into “[hh:]mm:ss” format.

Parameters:
  • tick : (number) (default: game.ticks_played)
Returns: