Reply To: LUA Scripts in Positive Feedback Loop

Home Forums General Programming LUA Scripts in Positive Feedback Loop Reply To: LUA Scripts in Positive Feedback Loop

#118870
spiffo
Participant
    • Topics: 12
    • Replies: 38
    • Total: 50

    runsource = function(–[[ CtrlrModulator –]] mod, –[[ number –]] value, –[[ number –]] source)

    Is that just an alternatively way of writing:

    function runsource(mod,value,source) ?

    I’ve just tried and both ways seem to work, so this could definitely be a way forward!

    Also I thought maybe you could just pass the source into the function like:
    function runsource(source) but you can’t it seems, you need to do the full (mod,value,source) as they all appear to be passed into the function it that particular order.

    To prevent Lua functions to be fired you indeed need to set a boolean, add a test at the beginning of all your “OnChange” methods, launch a timer to reset the boolean after all methods have gone through the test.

    I’m using this for loading data in all modulators from a file.
    Before starting the load, I set bLoadingProgram=true. In each OnChange methods i’m testing if bLoadingProgram == true and doing a direct return in that case.
    All methods will be triggered due to the load of each parameters.
    I also start a timer at load. Set it to enough time to have all your methods processed but not too much.
    When stopping the timer, reset the boolean to false so your methods are executed nicely on manual turn of a button.

    Yep that could be another way, I already have a Test & Timer running at startup to stop any unnecessary activity but another Test and another Timer for stopping certain scripts from running when not needed would be another way forward.

    “The more you learn, the more you realise how little you know”

    • This reply was modified 3 years, 10 months ago by spiffo.
    • This reply was modified 3 years, 10 months ago by spiffo.
    Ctrlr