Value Object Change Event

I looking to use Lua on my Novation Peak preset.

Specifically I want to show or hide a particular control when another controls is set to a particular value

Looking at the Lua documentation I think I’m going to have to use the Value object.

Does the value object have an event that is fired when it is changed. In my scenario I don’t really care whether the value was set by Midi or by the user on the Electra. Or am I looking at this the wrong way?

1 Like

You may want to take a look at the parameterMap object. That is the storage where all values reside and it has an event handler that is fired when there is a value change of any of the parameters. It does not matter what is the origin of the change (MIDI, UI, Lua)

a simple example:

-- Get a list of value objects affected by the change event

function parameterMap.onChange (valueObjects, midiValue)
    print ("a new midiValue " .. midiValue)

    for i, valueObject in ipairs (valueObjects) do
        local control = valueObject:getControl ()
        print (string.format ("affects control value %s.%s",
            control:getName (), valueObject:getId ()))

Full source is and preset is available at:

I am currently busy with other different work on Electra. I will add some more examples when I have a moment.

1 Like

That looks like it will do the trick. Many thanks

1 Like