From 446f2d6364f874f0c431aaefa11ecfeff27912e0 Mon Sep 17 00:00:00 2001 From: mcmicha Date: Wed, 8 Mar 2017 23:20:10 +0100 Subject: [PATCH] Add the function function ExportScript.Tools.negate() to negate the transfer values. --- Scripts/DCS-ExportScript/lib/Tools.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Scripts/DCS-ExportScript/lib/Tools.lua b/Scripts/DCS-ExportScript/lib/Tools.lua index b4f9977..9c3530d 100644 --- a/Scripts/DCS-ExportScript/lib/Tools.lua +++ b/Scripts/DCS-ExportScript/lib/Tools.lua @@ -134,10 +134,21 @@ function ExportScript.Tools.subst(s, t) return s end +--[[ function ExportScript.Tools.round(num, idp) local lMult = 10^(idp or 0) return math.floor(num * lMult + 0.5) / lMult end +]] + +-- this function negate the numeric input values +function ExportScript.Tools.negate(Input) + if type(Input) == "number" then + return (Input > 0.0 and (0 - Input) or (Input - Input - Input)) + else + return Input + end +end -- Status Gathering Functions function ExportScript.Tools.ProcessArguments(device, arguments)