Help with updating a curve point at run time with Lua script
Posted: Sat May 07, 2022 3:48 am
I would like to change a point on a curve using a lua script triggered by a trim switch. I am not sure on the syntax to do this. I started with:
local FM
local FMname
local createRes
local function init_func()
end
local function run_func()
FM, FMname = getFlightMode()
local curveVal = model.getCurve(31)
curveVal.y[1] = curveVal.y[1] + 1
createRes = model.setCurve(31, curveVal)
end
end
return { run=run_func, init=init_func }
The setCurve function fails. It seems to be around the way I update the Y value in the curve. Any help?
local FM
local FMname
local createRes
local function init_func()
end
local function run_func()
FM, FMname = getFlightMode()
local curveVal = model.getCurve(31)
curveVal.y[1] = curveVal.y[1] + 1
createRes = model.setCurve(31, curveVal)
end
end
return { run=run_func, init=init_func }
The setCurve function fails. It seems to be around the way I update the Y value in the curve. Any help?