Skip to content

utils Module#

Utility functions and constants exposed by DCS.

Fields#

Field Type Description
COLOR table Color table.
PI number Pi constant.
units table Units of measurement.

Functions#


adv_round#

Unknown.

value = utils.adv_round(value, maxAccuracy)

angleDegrees#

Unknown.

value = utils.angleDegrees(dd, mm, ss)

bitor#

Unknown.

value = utils.bitor(x, y)

copyTable#

Unknown.

utils.copyTable(dest, src)

createTableCopy#

Unknown.

copy = utils.createTableCopy(src)

dofileIn#

Executes a file in a supplied environment.

result, errmsg = utils.dofileIn(filename, env)

dofileInEx#

Executes a file in a supplied environment with a base table.

utils.dofileInEx(filename, env, base)

getTime#

Returns hours, minutes, and seconds for a duration.

hours, minutes, seconds = utils.getTime(sec)

get_azimuth#

Unknown.

azimuth = utils.get_azimuth(vec)

get_elevation#

Unknown.

elevation = utils.get_elevation(vec)

get_lengthZX#

Unknown.

length = utils.get_lengthZX(vec)

get_vec_length#

Unknown.

length = utils.get_vec_length(vec)

hasbit#

Unknown.

enabled = utils.hasbit(x, p)

invertColor#

Unknown.

color = utils.invertColor(color)

loadfileIn#

Loads a file into a compiled chunk with the given environment.

chunk, errmsg = utils.loadfileIn(filename, env)

Note

Parameters passed when calling the chunk are accessible with ... in the script.


makeColor#

Unknown.

color = utils.makeColor(r, g, b)

parseCordinates#

Returns latitude, longitude, and course parsed from a string.

latitude, longitude, course = utils.parseCordinates(str)

round#

Unknown.

value = utils.round(value, accuracy)

round_qty#

Unknown.

value = utils.round_qty(qty)

verifyChunk#

Verifies a compiled chunk.

utils.verifyChunk(chunk, errmsg)

Note

Performs a nil check and otherwise raises an error.