0. Note: When referring to a tutorial, please be sure to link to it. Don’ta assume we know it. I am not familiar with that tutorial so I couldn’t compare your code to it.
1. That code doesn’t make a lot of sense when I read it.
This statement in particular:
timer.performWithDelay( 1000, mySlide )
timer.peformWithDelay() takes a reference to a function or a closure, not a table.
This code would swap the image repeatedly and forever, once per second.
local mySlide = { "blue.png", "red.png", "orange.png" } print(#mySlide) local slideNum = 1 local lastSlide local function swapSlide() display.remove( lastSlide ) lastSlide = display.newImage(mySlide[slideNum]) lastSlide.x = 320 lastSlide.y = 480 slideNum = slideNum + 1 if( slideNum \> #mySlide ) then slideNum = 1 end end timer.performWithDelay( 1000, swapSlide, -1 )
2. Why not just fill with a new texture?
This article talks about using repeating fills, but it covers everything you need to know about changing the fill:
https://coronalabs.com/blog/2013/11/07/tutorial-repeating-fills-in-graphics-2-0/
local mySlide = { "blue.png", "red.png", "orange.png" } print(#mySlide) local slideNum = 1 local lastSlide = display.newImage(mySlide[slideNum]) lastSlide.x = 320 lastSlide.y = 480 local function swapSlide() slideNum = slideNum + 1 if( slideNum \> #mySlide ) then slideNum = 1 end lastSlide.fill = { type = "image", filename = mySlide[slideNum] } end timer.performWithDelay( 1000, swapSlide, -1 )