Here is my code:
local imgtable = { "1.png", "2.png","3.png","4.png","5.png" }; local r =math.random(1,#imgtable) local img = display.newImageRect(imgtable[r],40,40) img.x=display.contentCenterX img.y=display.contentCenterY local button = display.newCircle(img.x,img.y+80,40) local function changeImage() --????? end button:addEventListener("tap",changeImage)
I have a table of images and a random image from the table is displayed in the center. However I have button where the image is changed to a random image in the table. However, I do not know how to do this.
What do I do?
