Nil Value

Hi I am new to programming lua. I created a new image called “fake” and then I set fake.x = 160

and when i run it it says “fake” is a nil value.

MY CODE

______________________________________________________________________________________________________________________________________________________________________

function scene:createScene( event )

    local group = self.view

    

    local fake = display.newImage(“levels/level1/img1-2.jpg”)

    fake.x = 160

    fake.y = 240

    local pic1 = display.newImage(“levels/level1/img1.jpg”)

    pic1.x = 160

    pic1.y = 240

    

    local pic2 = display.newImage(“levels/level1/img1.jpg”)

    pic2.x = 480

    pic2.y = 640

    

    local grass = display.newImageRect( “grass.png”, screenW, 82 )

    grass:setReferencePoint( display.BottomLeftReferencePoint )

    grass.x, grass.y = 0, display.contentHeight

        

    group:insert( fake)

    group:insert( pic1 )

    group:insert( pic2 )

    group:insert( grass)

end

______________________________________________________________________________________________________________________________________________________________________

Are you sure the image name and path are correct?  There doesn’t seem to be anything wrong with the code above.  Are you using “fake” anywhere else in your code?

thanks for the reply. you were right it was the image path i copied and pasted it from the image “pic1” and kept the .jpg extension instead of changing it to .png 

Are you sure the image name and path are correct?  There doesn’t seem to be anything wrong with the code above.  Are you using “fake” anywhere else in your code?

thanks for the reply. you were right it was the image path i copied and pasted it from the image “pic1” and kept the .jpg extension instead of changing it to .png