Displaying a random image when an image is tapped?

I am a total noob to programming and lua ( i don’t have a developer program subscription anywhere yet! ) and am currently just developing apps for fun. I don’t know if this has been posted elsewhere, but I am having trouble making a random image appear when someone clicks on an image. I have 10 images in the folder. Here is my code so far.

[lua]local background = display.newImage ( “white.png” )
background.y = 500

local text = display.newText ( “Tap item to change.”, 5, 60, native.systemFont, 45 )
text:setTextColor ( 255, 0, 0 )
local r = math.random ( 1, 10 )
local item = display.newImage ( itemNum".png", 90, 350 )

function item:tap (event)
local r = math.random ( 1, 10 )
local item = display.newImage ("[r].png", 90, 350)
media.playEventSound ( “coin.wav” )
end
item:addEventListener ( “tap”, item )

Thanks! [import]uid: 16721 topic_id: 11701 reply_id: 311701[/import]

At a quick glance I can see two issues:

local item = display.newImage ( itemNum".png", 90, 350 )  

Should be:

local item = display.newImage ( itemNum .. ".png", 90, 350 )  

And I’m assuming your images are called 1.png, 2.png etc? If so, this line:

local item = display.newImage ("[r].png", 90, 350)  

Should be:

local item = display.newImage (r .. ".png", 90, 350)  

Give that a try and see if there are any errors in the console. [import]uid: 5833 topic_id: 11701 reply_id: 42555[/import]