Results 1 to 3 of 3
  1. #1
    25+ Posting Member Roarkr's Avatar
    Join Date
    Feb 2011
    Location
    Asker Norway
    Posts
    61
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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, -214748364
    ipc.control(69990, 52428
    ipc.control(69990, -214748364
    ipc.control(69990, 52428
    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, -214748364
    ipc.control(70046, 52428
    ipc.control(70046, -214748364
    ipc.control(70046, 52428
    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
    Roar Kristensen rksoftware www.flightsim4fun.com
    Flightsimmer since 1982 (Sinclair Spectrum Sinclair QL, Amiga, PC --16Mhz >>4.4GHz)

  2. #2
    75+ Posting Member
    Join Date
    Apr 2009
    Location
    Toronto
    Posts
    125
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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

  3. #3
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: How to make a call from SIOC to a LUA function

    Hi,
    Or you could send an FSControl from SIOC to FSUIPC, or toggle one of the FSUIPC Virtual buttons from SIOC, see keygen part, method 2.
    regards,
    Nico Kaan