Using a function from one of the components within the plugin from another component with different arguments simultaneously

BECOME PART OF THE COMMUNITY - Sign up here
  • Hi all,


    Is it possible to use a function from one of the components within the plugin from another component but with different arguments simultaneously?

    For example, I want to use a function from this plugin to move 3 faders simultaneously. I put function move_fader() to the first component and in the second I do this

    Code
    return function ()
        local commands = {'page 1.201 at 100 fade 1','page 1.202 at 70 fade 1','page 1.203 at 50 fade 1'}    
        for _,command in pairs(commands) do
            move_fader(command)
            coroutine.yield(0)
        end    
    end

    But it moves faders one by one, but not all together.

    Is there a way to make them move together?

  • the 'for' command is iterating through table 'commands' . So it passes each table element independently. You would need to rethink the logic if you wanted to have them all happen at once.

  • Thanks Andreas

    This is almost what I did.

    I did it by recalling the plugin component and passing the argument.

    Code
    local args = {1,2,3}
    for _,arg in pairs(args) do
        Cmd('plugin 1.1 "'..arg..'"')
    end

    But I thought of doing it without Cmd() but I guess this is not possible, right?


    BTW - which way you think is better, yours (recalling global function) or mine (recalling plugin component)? I personally don't like creating global functions...

  • avoiding globals and keeping execution within the Lua engine would be preferable yes.


    here's an approach that avoids both globals and invoking the commandline interpreter:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!