(Solved)Can Api Be Used To Add Send Tracks?

hi, can the api be used to add send tracks?
i see renoise.song().send_track_count can be used to achieve the listing of current send track count, but can the api be used to add a send track?

renoise.song():insert_track_at(index)

index being a number equal or higher to master index.

renoise.song.api:

Yep. I’m not entirely sure why I’m having difficulties figuring out how to get the number of the master track…

okay… +2 it is :)

  
local stc=renoise.song().sequencer_track_count+2  
if renoise.song().send_track_count <4 then renoise.song():insert_track_at(stc)  
  
local NOTE_TRACK = renoise.Track.TRACK_TYPE_SEQUENCER  
local MASTER_TRACK = renoise.Track.TRACK_TYPE_MASTER  
local SEND_TRACK = renoise.Track.TRACK_TYPE_SEND  
local master_track_index = nil  
  
for i = 1,#renoise.song().tracks do  
 if renoise.song().tracks[i].type == MASTER_TRACK then  
 master_track_index = i  
 break  
 end  
}  
  

some code i wrote to get the master track

if you just need to add a track at the end couldn’t you just do:
renoise.song():insert_track_at(#renoise.song().tracks)

This is more future proof than this?

local master_index = renoise.song().sequencer_track_count + 1  

This looks fun, but got it working with the +2 method. I know it’s a hack but it seems to work.