Lua in 9.2 cannot set group color?

Hello,

Relatively new to Ardour and LUA. I’ve got a working script that sets track and bus colors based on key words in each track/bus name. Works perfectly. Tonight I tried to add groups to the same script and hit a wall. Here is my group loop:

for g in Session:route_groups():iter() do
    local gname = g:name():lower()
    if gname == "fx" then
       print( "Successful match!" )
       local pi = g.presentation_info_ptr()
       pi:set_color(0xFFFFFFFF)
    end
end

I do see “Successful match!” print in the output, so I know the loop itself is working. However, I get an error: “attempt to call a nil value (field ‘presentation_info_ptr’).” When I looked for this error online, I got back many results about needing to initialize the group correctly with ARDOUR:RouteGroup(). I’m not sure how that applies to my situation. I’m not trying to use LUA to create a group. I’m just trying to modify the color of groups I created using the Ardour software menus.

I also tried just doing “g:set_color()”, but that didn’t work.

Thank you in advance for your help.

1 Like

Hello and welcome,

I don’t know much LUA, but I can point you to some excellent scripts by @holgerd that do exactly what you want.

I don’t want to dissuade you from writing your own, but Holger’s work would be a good resource for you.

For example a quick look at his code suggests RouteGroup.set_rgba() might be the method you’re looking for. :slight_smile:

Peace,
-Manuel

1 Like