run time error - run time error attempt to index local a nil value stack traceback

Hi,

getting the run time error attempt to index local a nil value stack traceback for the below block of code. is there anything wrong with the below code?

local evol\_img evol\_img = display.newImageRect("Game 2.0/Play Scren/task/Avatar\_Level/"..evolution.."\_finish.png",evolution\_img.width,evolution\_img.height) evol\_img.x = evolution\_img.x evol\_img.y = evolution\_img.y sceneGroup:insert(evol\_img) display.remove(evolution\_img) end

error attached

Hi @desiventure6,

Thanks for posting your code, but I don’t think there’s enough here to detect what’s going wrong. There are various references to variables like “evolution” and “evolution_img” that we can’t see in the code you provide, so we can’t help diagnose why the program is erroring.

Why not just combine these lines…

[lua]

local evol_img

evol_img = display.newImageRect(“Game 2.0/Play Scren/task/Avatar_Level/”…evolution…"_finish.png",evolution_img.width,evolution_img.height)

[/lua]

… into this line?

[lua]
local evol_img = display.newImageRect(“Game 2.0/Play Scren/task/Avatar_Level/”…evolution…"_finish.png",evolution_img.width,evolution_img.height)

[/lua]

Best regards,

Brent

Hi @desiventure6,

Thanks for posting your code, but I don’t think there’s enough here to detect what’s going wrong. There are various references to variables like “evolution” and “evolution_img” that we can’t see in the code you provide, so we can’t help diagnose why the program is erroring.

Why not just combine these lines…

[lua]

local evol_img

evol_img = display.newImageRect(“Game 2.0/Play Scren/task/Avatar_Level/”…evolution…"_finish.png",evolution_img.width,evolution_img.height)

[/lua]

… into this line?

[lua]
local evol_img = display.newImageRect(“Game 2.0/Play Scren/task/Avatar_Level/”…evolution…"_finish.png",evolution_img.width,evolution_img.height)

[/lua]

Best regards,

Brent