How to play musics in list

I hv a table , names of mp3 are in the table in order.

Such as list = {“aaa”,“bbb”,“ccc”}

I want to play these music one by one , when aaa is finished , play bbb.

I used
for i,v in ipair(list) do
Music(i)
End

But i found it is only playing ccc. Ccc is played well.
By checking, aaa ,bbb is played in a very short time , they are passed away very quick. (My music function is not in draw)

So , pls help. Pls give a idea to play one by one.

Thanks so much

@totorofat It doesn’t matter where the for loop is, it goes thru each iteration as fast as it can. Ccc is played correctly because it’s the last one to be played. What you need to do is play the first one in the list, then when it’s finished play the second one, then the third one. You need to use music.currentTime and music.duration . When music.currentTime is equal or greater than music.duration then the music that’s playing is done. Then you can start the next one in the list.

Here’s a demo to play music from a table, one after the other.

function setup()
    textMode(CORNER)
    pos=0
    m={"A Hero's Quest:Tavern & Inn","A Hero's Quest:In the City","A Hero's Quest:Exploration"}
    md=0
end

function draw()
    background(0)
    fill(255)
    play()
    text("playing  = "..m[pos],100,HEIGHT/2+50)
    text("current time  = "..music.currentTime,100,HEIGHT/2)
    text("duration        = "..music.duration,100,HEIGHT/2-50)
end

function play()
    mc=music.currentTime
    if md-mc<.1 then
        pos=pos+1
        if pos>#m then
            pos=1
        end
        music(m[pos])  
        md=music.duration 
    end 
end

Woo… your code is so great to help. Thank u so much . dave.
I hv do some correction to fit my code. All can work well now… thank u again.