refactor: add function annotation and check return value
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
parent
6a39d65a5b
commit
b3593bd713
|
@ -9,7 +9,9 @@ ardour {
|
|||
function factory()
|
||||
-- there is currently no direct way to find the track
|
||||
-- corresponding to a [selected] region
|
||||
function find_track_for_region(region_id)
|
||||
---@param region_id ID
|
||||
---@return Track?
|
||||
local function find_track_for_region(region_id)
|
||||
for route in Session:get_tracks():iter() do
|
||||
local track = route:to_track()
|
||||
local pl = track:playlist()
|
||||
|
@ -30,8 +32,7 @@ function factory()
|
|||
-- for each selected region...
|
||||
for region in sel.regions:regionlist():iter() do
|
||||
-- test if it's an audio region
|
||||
local ar = region:to_audioregion()
|
||||
if ar:isnil() then
|
||||
if region:to_audioregion():isnil() then
|
||||
goto next
|
||||
end
|
||||
|
||||
|
@ -48,6 +49,7 @@ function factory()
|
|||
|
||||
local track = find_track_for_region(rid)
|
||||
|
||||
if track then
|
||||
region:to_stateful():clear_changes()
|
||||
|
||||
--~ print("Marker label:", mloc:name())
|
||||
|
@ -56,6 +58,7 @@ function factory()
|
|||
|
||||
-- collect undo data
|
||||
Session:add_stateful_diff_command(region:to_statefuldestructible())
|
||||
end
|
||||
|
||||
::next::
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue