Option list do not work as expected

Martin, I feel like I’ve found a bug. (It could also be incorrect use of LUA code.) Look at my pictures.

First I add two option lists.

The result in Electra display is like this.

That is correct. Option list called ‘FUNCTION’ has three values as it should. LUA code also added a name and a overlay the to second option list.

Then I add another option list.

The result in Electra display is like this.

That is correct. Option list called ‘FUNCTION’ still has three values.

If I move the option list to be first.

The result in Electra display is like this.

This is NOT correct. Look at the option list called ‘FUNCTION’, it has now four values. it should have three.

I also have some LUA code.

– define values and labels
local lists = {

noise = {
    { value = 0, label = "High" },
    { value = 1, label = "Low" },
    { value = 2, label = "Peak" },
    { value = 3, label = "Decin" }
},

vpn = {
    { value = 0, label = "Sin1" },
    { value = 1, label = "Sin2" },
    { value = 2, label = "Sin3" },
    { value = 3, label = "Sin4" },
    { value = 4, label = "Saw1" },
    { value = 5, label = "Saw2" },
    { value = 6, label = "Sqr1" },
    { value = 7, label = "Sqr2" },
    { value = 8, label = "Fat1" },
    { value = 9, label = "Fat2" },
    { value = 10, label = "Air1" },
    { value = 11, label = "Air2" },
    { value = 12, label = "Decay1" },
    { value = 13, label = "Decay2" },
    { value = 14, label = "Creep" },
    { value = 15, label = "Throdt" }
},

user = {
    { value = 0, label = "Waves" },
    { value = 1, label = "User2" },
    { value = 2, label = "User3" },
    { value = 3, label = "User4" },
    { value = 4, label = "User5" },
    { value = 5, label = "User6" },
    { value = 6, label = "User7" },
    { value = 7, label = "User8" },
    { value = 8, label = "User9" },
    { value = 9, label = "User10" },
    { value = 10, label = "User11" },
    { value = 11, label = "User12" },
    { value = 12, label = "User13" },
    { value = 13, label = "User14" },
    { value = 14, label = "User15" },
    { value = 15, label = "User16" }
}

}

– create overlays
overlays.create(2, lists.noise)
overlays.create(3, lists.vpn)
overlays.create(4, lists.user)

function set_function(valueObject, value)
– your code goes here
if value == 0 then
controls.get(2):setName(“NOISE”)
– set overlay
controls.get(2):getValue():setOverlayId(2)
end

 if value == 1 then
    controls.get(2):setName("VPN")
    -- set overlay
    controls.get(2):getValue():setOverlayId(3)
end

if value == 2 then
    controls.get(2):setName("USER")
    -- set overlay
    controls.get(2):getValue():setOverlayId(4)
end

end

UPDATE: I just discovered that it’s only the option list (if I put it above the rest) that causes the error.

This works:

Not this:

would it be possible to share (PM) a link to the preset. It would make it easier for me to see the issue.

1 Like

I have sent you the link.

1 Like

You create an overlay in Lua that as the same id as another overlay define in JSON. If you use unique (unused) id, it should work fine.

I will adjust the overlays.create() function to create overlays to report the conflict.

Thanks Martin, I almost realized I had made a mistake. I’ll test it now.