Module Utils
This module contains derived utilities taken from the MIST framework, which are excellent tools to be reused in an OO environment!.
Authors:
- Grimes : Design & Programming of the MIST framework.
Contributions:
- FlightControl : Rework to OO framework
Global(s)
| FLARECOLOR | |
| SMOKECOLOR | |
| UTILS | |
| lookup_table |
Type FLARECOLOR
| FLARECOLOR.Green | |
| FLARECOLOR.Red | |
| FLARECOLOR.White | |
| FLARECOLOR.Yellow |
Type SMOKECOLOR
| SMOKECOLOR.Blue | |
| SMOKECOLOR.Green | |
| SMOKECOLOR.Orange | |
| SMOKECOLOR.Red | |
| SMOKECOLOR.White |
Type UTILS
| UTILS.BasicSerialize(s) | |
| UTILS.DeepCopy(object) | |
| UTILS.DoString(s) | |
| UTILS.FeetToMeters(feet) | |
| UTILS.IsInstanceOf(object, className) |
Function to infer instance of an object Examples:
|
| UTILS.KmphToMps(kmph) | |
| UTILS.KnotsToKmph(knots) | |
| UTILS.KnotsToMps(knots) | |
| UTILS.MetersToFeet(meters) | |
| UTILS.MetersToNM(meters) | |
| UTILS.MpsToKmph(mps) | |
| UTILS.MpsToKnots(mps) | |
| UTILS.NMToMeters(NM) | |
| UTILS.OneLineSerialize(tbl) | |
| UTILS.Round(num, idp) |
From http://lua-users.org/wiki/SimpleRound use negative idp for rounding ahead of decimal place, positive for rounding after decimal place |
| UTILS.ToDegree(angle) | |
| UTILS.ToRadian(angle) | |
| UTILS.spairs(t, order) | |
| UTILS.tostringLL(lat, lon, acc, DMS) | |
| UTILS.tostringMGRS(MGRS, acc) |
Global(s)
Type Utils
Type FLARECOLOR
Field(s)
Type SMOKECOLOR
Field(s)
Type UTILS
Utilities static class.
Field(s)
- UTILS.BasicSerialize(s)
-
porting in Slmod's "safestring" basic serialize
Parameter
-
s:
-
- UTILS.DeepCopy(object)
-
from http://lua-users.org/wiki/CopyTable
Parameter
-
object:
-
- UTILS.DoString(s)
-
porting in Slmod's dostring
Parameter
-
s:
-
- UTILS.FeetToMeters(feet)
-
Parameter
-
feet:
-
- UTILS.IsInstanceOf(object, className)
-
Function to infer instance of an object
Examples:
UTILS.IsInstanceOf( 'some text', 'string' ) will return true
UTILS.IsInstanceOf( some_function, 'function' ) will return true
UTILS.IsInstanceOf( 10, 'number' ) will return true
UTILS.IsInstanceOf( false, 'boolean' ) will return true
UTILS.IsInstanceOf( nil, 'nil' ) will return true
UTILS.IsInstanceOf( ZONE:New( 'some zone', ZONE ) will return true
UTILS.IsInstanceOf( ZONE:New( 'some zone', 'ZONE' ) will return true
UTILS.IsInstanceOf( ZONE:New( 'some zone', 'zone' ) will return true
UTILS.IsInstanceOf( ZONE:New( 'some zone', 'BASE' ) will return true
UTILS.IsInstanceOf( ZONE:New( 'some zone', 'GROUP' ) will return false
Parameters
-
object: is the object to be evaluated -
className: is the name of the class to evaluate (can be either a string or a Moose class)
Return value
#boolean:
- UTILS.KmphToMps(kmph)
-
Parameter
-
kmph:
-
- UTILS.KnotsToKmph(knots)
-
Parameter
-
knots:
-
- UTILS.KnotsToMps(knots)
-
Parameter
-
knots:
-
- UTILS.MetersToFeet(meters)
-
Parameter
-
meters:
-
- UTILS.MetersToNM(meters)
-
Parameter
-
meters:
-
- UTILS.MpsToKmph(mps)
-
Parameter
-
mps:
-
- UTILS.MpsToKnots(mps)
-
Parameter
-
mps:
-
- UTILS.NMToMeters(NM)
-
Parameter
-
NM:
-
- UTILS.OneLineSerialize(tbl)
-
porting in Slmod's serialize_slmod2
Parameter
-
tbl:
-
- UTILS.Round(num, idp)
-
From http://lua-users.org/wiki/SimpleRound use negative idp for rounding ahead of decimal place, positive for rounding after decimal place
Parameters
-
num: -
idp:
-
- UTILS.ToDegree(angle)
-
Parameter
-
angle:
-
- UTILS.ToRadian(angle)
-
Parameter
-
angle:
-
- UTILS.spairs(t, order)
-
Here is a customized version of pairs, which I called spairs because it iterates over the table in a sorted order.
Parameters
-
t: -
order:
-
- UTILS.tostringLL(lat, lon, acc, DMS)
-
acc: in DM: decimal point of minutes. In DMS: decimal point of seconds. position after the decimal of the least significant digit: So: 42.32 - acc of 2.
Parameters
-
lat: -
lon: -
acc: -
DMS:
-
- UTILS.tostringMGRS(MGRS, acc)
-
acc- the accuracy of each easting/northing. 0, 1, 2, 3, 4, or 5.
Parameters
-
MGRS: -
acc:
-