Iterating over selected note columns on multiple tracks

here’s what I have, but I can only get it to modify note columns in Track 1… feel like I’m missing something incredibly obvious. (changing delay value is just a placeholder for now)

edit - … I’ve been sitting there with only Track 1’s delay column visible, lol. classic tunnel vision and then figure out the problem right after you ask for help

edit 2 - oops, meant to post this in Beginners LUA API Sandbox. my bad

local sel_pattern_index = renoise.song().selected_pattern_index
local start_track_index = renoise.song().selection_in_pattern['start_track']
local end_track_index = renoise.song().selection_in_pattern['end_track']

for track_index = start_track_index, end_track_index do

  for pos, note_column in renoise.song().pattern_iterator:note_columns_in_pattern_track(sel_pattern_index, track_index) do
  
    if note_column.is_selected then
    -- do stuff
      note_column.delay_value = 42
    end
   
  end
  
end

edit - better, I think:

local sel_pattern_index = renoise.song().selected_pattern_index
local start_track_index = renoise.song().selection_in_pattern['start_track']
local end_track_index = renoise.song().selection_in_pattern['end_track']

for track_index = start_track_index, end_track_index do

  local curr_track = renoise.song():track(track_index)
  
  if not curr_track.delay_column_visible then
    curr_track.delay_column_visible = true
  end

  for pos, note_column in renoise.song().pattern_iterator:note_columns_in_pattern_track(sel_pattern_index, track_index) do
  
    if note_column.is_selected then
      note_column.delay_value = 42
    end
   
  end
  
end