About Pattern Search

I want to find the first ZTxx effect found before the current position ONLY in sequencers track (not master or send).

How can I do this in a performant way ?

  
function search_effect(pattern,track)  
 local song = renoise.song()  
 local pattern_lines = song.selected_pattern.number_of_lines   
 local track_type = song.patterns[pattern].tracks[track].type   
  
 if track_type == renoise.Track.TRACK_TYPE_MASTER or  
 track_type == renoise.Track.TRACK_TYPE_SEND or   
 track_type == renoise.Track.TRACK_TYPE_GROUP or  
 (song.patterns[pattern_index].tracks[track_index].is_alias == true) then  
 print(song.patterns[pattern].tracks[track].is_alias)  
 return --Do not process master, send, group or aliassed track!!  
 end  
  
 --..  
 --..  
 --code to locate ZTxx effects in any other track.  
 --..  
 --..  
 end  
  

Ok, there there is not a better way than search manually line by line.

I need to start from the current sequence and go backward, so I’ve looked for

renoise.song().transport.playback_pos  

that returns a string composed by [sequence, lines].

Do I need to do a split or there is another function more accurate ?

You could try and steal some techniques from Taktik’s Find and Replace tool, i bet it has some functions that you could abuse for your purpose: