Module hoggit.utils

utils.lua Uncategorized utilities that are used often enough to justify inclusion in the framework

Functions

HOGGIT.randomInList (table) Given a table with indexes as keys (a list in any other language, thanks lua) returns a random element
HOGGIT.filterTable (t, filter) Filters out elements that do not return true when passed to the function "filter"
HOGGIT.listContains (list, elem) Checks to see if value "elem" is contained in any value of table "list"
HOGGIT.getLatLongString (pos, decimal) Takes a DCS Vec2 position and returns a string with the lat and long
HOGGIT.getSmokeName (a) Returns a textual smoke name based on the provided enum
HOGGIT.GroupIsAlive (group) Returns if Group object is alive.


Functions

HOGGIT.randomInList (table)
Given a table with indexes as keys (a list in any other language, thanks lua) returns a random element

Parameters:

  • table A table with indexes as keys

Returns:

    A random element from the table
HOGGIT.filterTable (t, filter)
Filters out elements that do not return true when passed to the function "filter"

Parameters:

  • t Table to iterate over
  • filter Function that each element in table "t" will be passed into.

Returns:

    New table with filtered elements only
HOGGIT.listContains (list, elem)
Checks to see if value "elem" is contained in any value of table "list"

Parameters:

  • list Table to check
  • elem Value to look for in each table element

Returns:

    True/False if "elem" was found in "list"
HOGGIT.getLatLongString (pos, decimal)
Takes a DCS Vec2 position and returns a string with the lat and long

Parameters:

  • pos Vec2 from DCS engine
  • decimal if true then return result in Decimal instead of Seconds

Returns:

    The Lat/Long string
HOGGIT.getSmokeName (a)
Returns a textual smoke name based on the provided enum

Parameters:

  • a trigger.smokeColor enum

Returns:

    the English word as a string representing the color of the smoke. i.e. trigger.smokeColor.Red returns "Red"
HOGGIT.GroupIsAlive (group)
Returns if Group object is alive. This will catch some of the edge cases that the more common functions miss.

Parameters:

  • group Group

Returns:

    True if Group is indeed, alive. False otherwise.
generated by LDoc 1.4.6 Last updated 2018-12-26 22:12:27