File utils/arrayutil.lua

Functions

arrayutil.reduce2d (array, is_empty) Removes empty rows and columns at the beginning and the end of the given array.
arrayutil.swapped_reindex2d (data, new_x, new_y) Reindexes the given 2D array, swapping the two dimensions.
arrayutil.swapped_reindex3d (data, new_x, new_y, new_z) Reindexes the given 3d array, swapping the two dimensions.


Functions

arrayutil.reduce2d (array, is_empty)
Removes empty rows and columns at the beginning and the end of the given array.

Parameters

  • array: The array.
  • is_empty: Optional. The function used for determining if the item is empty. By default nil and an empty string is considered empty. Expected is a function that takes one item and returns a boolean.
arrayutil.swapped_reindex2d (data, new_x, new_y)
Reindexes the given 2D array, swapping the two dimensions.

Parameters

  • data: The array to reindex.
  • new_x: The new startpoint for the first dimension.
  • new_y: The new startpoint for the second dimension.

Return value:

The reindexed array.
arrayutil.swapped_reindex3d (data, new_x, new_y, new_z)
Reindexes the given 3d array, swapping the two dimensions.

Parameters

  • data: The array to reindex.
  • new_x: The new startpoint for the first dimension.
  • new_y: The new startpoint for the second dimension.
  • new_z: The new startpoint for the third dimension.

Return value:

The reindexed array.

Valid XHTML 1.0!