If u have an array of images cant u just make a for loop to display them after each other. Idk the Lua syntax but you can try to apply this concept to Lua:
imgArray = // Array of images in order
for (i=0; i < imgArray.length; i++) {
changeBackgroundFunctionOrWhatever(imgArray[i], interval);
// ^ This isn't an function, but you get the idea ^
}
for i=0, i < imageArray do
-- change background function
end
-- No actual idea if this is how it would look in Lua but try