Regarding ipairs iteration, something that might be worth mentioning is that example 1 is faster than example 2.
Note that this doesn’t seem true for renoise.song() tables (,lines, .note_columns et c). I am guessing that iterations of these are customized and optimized behind the scenes. Otherwise:
Example 1:
local my_table = { 1, 42, 3, 7, 10 }
for i = 1, #my_table do
local val = my_table[i]
-- code
end
Example 2:
local my_table = { 1, 42, 3, 7, 10 }
for i, val in ipairs(my_table) do
-- code
end