How to make a call from SIOC to a LUA function
Hi,
I wonder if it is possible to make a call from SIOC to a LUA function defined in FSUIPC.
I want to call ( execute) a LUA function when I toogle a switch that is defined in SIOC
like:
Var 74 Link IOCARD_SW Input 65 Type I
{
IF v74 = 1
{ call LUA function toggleVORL( or something like this)
}
example of LUA function:
local function toggleVORL(state, unit)
if state == 0 and ipc.readLvar('ngx_switch_358_a') ~= 0 then
ipc.control(69990, -2147483648)
ipc.control(69990, 524288)
ipc.control(69990, -2147483648)
ipc.control(69990, 524288)
elseif state == 1 and ipc.readLvar('ngx_switch_358_a') == 0 then
ipc.control(69990, 536870912)
ipc.control(69990, 131072)
end
else
if state == 0 and ipc.readLvar('ngx_switch_414_a') ~= 0 then
ipc.control(70046, -2147483648)
ipc.control(70046, 524288)
ipc.control(70046, -2147483648)
ipc.control(70046, 524288)
elseif state == 1 and ipc.readLvar('ngx_switch_414_a') == 0 then
ipc.control(70046, 536870912)
ipc.control(70046, 131072)
end
end
end
rgs,
Roar K
Re: How to make a call from SIOC to a LUA function
Hello Roar.
Not directly, but you could place your arguments in one of FSUIPC's user offsets and use the "intercept" event from the FSUIPC library to drive your LUA script.
Jim
Re: How to make a call from SIOC to a LUA function