Module: gears.math

Math module for gears

Static module functions

gears.math.subsets (set) Return all subsets of a specific set.
gears.math.cycle (t, i) Make i cycle.
gears.math.round (x) Round a number to an integer.


Static module functions

gears.math.subsets (set)
Return all subsets of a specific set. This function, giving a set, will return all subset it. For example, if we consider a set with value { 10, 15, 34 }, it will return a table containing 2n set: { }, { 10 }, { 15 }, { 34 }, { 10, 15 }, { 10, 34 }, etc.

Parameters:

  • set A set.

Returns:

    A table with all subset.
gears.math.cycle (t, i)
Make i cycle.

Parameters:

  • t A length. Must be greater than zero.
  • i An absolute index to fit into #t.

Returns:

    An integer in (1, t) or nil if t is less than or equal to zero.
gears.math.round (x)
Round a number to an integer.

Parameters:

  • x number

Returns:

    integer
generated by LDoc 1.4.6 Last updated 2030-01-01 00:00:00