MIST roundTbl

From DCS World Wiki - Hoggitworld.com
Revision as of 08:27, 13 April 2018 by Grimes (talk | contribs) (Created page with "{{Mission Scripting |fName= mist.utils.roundTbl| |vNum = Mist 4.1 |desc= This function rounds all values on the first level of a table to the desired amount. Numbers within...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


mist.utils.roundTbl

Added with: Mist 4.1
Description
This function rounds all values on the first level of a table to the desired amount. Numbers within nested tables will be ignored. Optional idp defines how many places after the decimal to round the number to; for example, an idp of 2 means the number will be rounded to the nearest hundredth. idp can be negative too, for example, -3 would round to the nearest thousand. If not specified, idp defaults to 0 (rounds to the nearest whole number).
Syntax
table mist.utils.roundTbl(table numbers )
Valid Input Values:
table with numbers
Return value:
table
Return example:
Usage Examples:
The following will return a vec3 table of the units current position rounded to tenths of a meter.

do

local point = mist.utils.roundTbl(Unit.getByName('myUnit').getPosition().p, 1)

end

Notes:
Related Functions
converter, toDegree, toRadian, round, roundTbl, metersToNM, metersToFeet, NMToMeters, feetToMeters, mpsToKnots, mpsToKmph, knotsToMps, kmphToMps, kelvinToCelsius, FahrenheitToCelsius, celsiusToFahrenheit, hexToRGB

Scripting Engine

MIST Root Page