Is there a way to short-hand the code below using an incremental variable to lessen the amount of times to compare items? For this example, increment every location where a '1' is typed??
Code:
elseif string.starts(nameOut, "Special 1") then -- found 'Start' marker
Song1SMarked = true
Song1StartMarkerNum = retval
Song1Title = MkrSegments[2]
Song1Singer = MkrSegments[3]
GUI.Val("Song1Tracks", MkrSegments[4])
GUI.Val("Song1Scene", MkrSegments[5])
Song1StartMarkerButtonText = reaper.format_timestr(posOut, "")
GUI.elms.Song1StartButton.func = EditSong1Start
.
.
.
-- code pattern to repeat....
elseif string.starts(nameOut, "Special 200") then
Song200SMarked = true
Song200StartMarkerNum = retval
Song200Title = MkrSegments[2]
Song200Singer = MkrSegments[3]
GUI.Val("Song200Tracks", MkrSegments[4])
GUI.Val("Song200Scene", MkrSegments[5])
Song200StartMarkerButtonText = reaper.format_timestr(posOut, "")
Maybe something like:
Code:
elseif string.starts(nameOut, "Special " .. i) then -- found 'Start' marker
Song{i}SMarked = true
Song{i}StartMarkerNum = retval
Song{i}Title = MkrSegments[2]
Song{i}Singer = MkrSegments[3]
GUI.Val("Song" .. i .. "Tracks", MkrSegments[4])
GUI.Val("Song" .. i .. "Scene", MkrSegments[5])
Song{i}StartMarkerButtonText = reaper.format_timestr(posOut, "")
GUI.elms.Song{i}StartButton.func = EditSong{i}Start
I've tried a few different variations, but either it's not possible, or I'm doing it wrong.