Reply To: 4 separate on/off switches on same parameter address?

Home Forums General Programming 4 separate on/off switches on same parameter address? Reply To: 4 separate on/off switches on same parameter address?

#73023
dnaldoog
Participant
    • Topics: 4
    • Replies: 480
    • Total: 484
    • ★★

    Hi Human Fly – arg must be an array or table as it is (usually?) called in Lua. An array is a set of usually related items collected together so you can loop through them.
    for i,v in ipairs(arg) do...
    will then loop through the array – i is the position in the array (a counter) starting at 1 and v is the value for that position. Obviously very useful if you have a large number of items to process.

    For example on page 117 of the Roland D110 manual you could have a lua array of all the parameters in 5-1-2 starting with WG Pitch Coarse as the first item in your table and the last (58th 0x3A -> 0-57) item TVA Env Sustain level. The D110 address of each parameter would be i-1 (the Roland will start at 0, not 1)

    arrayOfParams={"WG Pitch Coarse",..[insert 56 items here]....,"TVA Env Sustain level"}
    for i,v in ipairs(arrayOfParams)do
    console(String("address is: "..string.format("%0.2x",i-1)..": name is "..v))
    end
    Ctrlr