View Single Post
Old 05-21-2020, 11:40 AM   #14
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

In mespotine's example, actually both methods give the same results:
Code:
local _, chunk = reaper.GetTrackStateChunk( reaper.GetTrack(0,0), "", false )
-- my example track chunk has 8719 lines
-- times_to_run = 1000


function step_by_step()
  -- So first: get all AUXRECV-entries(which is just a couple of lines)
  local t = {}
  for entry in chunk:gmatch("AUXRECV.-\n") do
    -- Second: get the second parameter
    -- AUXRECV 1 (0) 1 0 0 0 0 0 0 -1:U 0 -1 ''
    local number = entry:match("AUXRECV %d (%d)")
    if number then t[#t+1] = number end
  end
  return t
end

function one_go()
  local t = {}
  for number in chunk:gmatch("AUXRECV %d (%d)") do
    t[#t+1] = number
  end
  return t
end
Code:
step_by_step: 4.129 sec
one_go: 4.136 sec
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote