Question About Patterniterator Example

Hello,

I have a question about an example in the PatternIterator.lua snippet. Am I crazy or does this example only change the first note (note_columns[1]) instead of all notes. I also don’t understand pairs(line.note_columns) since note_column is not used in the body?

– change notes in selection
– (all "C-4"s to “E-4” in the selection in the current pattern)

local pattern_iter = renoise.song().pattern_iterator
local pattern_index = renoise.song().selected_pattern_index

for pos,line in pattern_iter:lines_in_pattern(pattern_index) do
for _,note_column in pairs(line.note_columns) do
if (line.note_columns[1].is_selected and
line.note_columns[1].note_string == “C-4”) then
line.note_columns[1].note_string = “E-4”
end
end
end

The example indeed is confusing. Should be:

  
-- change notes in selection  
-- (all "C-4"s to "E-4" in the selection in the current pattern)  
  
local pattern_iter = renoise.song().pattern_iterator  
local pattern_index = renoise.song().selected_pattern_index  
  
for pos,line in pattern_iter:lines_in_pattern(pattern_index) do  
 for _,note_column in pairs(line.note_columns) do   
 if (note_column.is_selected and note_column.note_string == "C-4") then  
 note_column.note_string = "E-4"  
 end  
 end  
end  
  

Fixed in SVN?

It is now, r945.