Why am I getting this runtime error before the function is even called?
Runtime error
…er/Data1/iDev/Corona Projs/TOT/TOTbuttonHandlers.lua:2: attempt to concatenate global ‘buttonRotation’ (a nil value)
local setSelectedPiece = function()
local selectedPiece=display.newImage("Player1-Piece".. buttonRotation ..".png")
return selectedPiece
end
local buttonRotation = 0
local currentPiece = setSelectedPiece()
The ‘setSelectedPiece’ function isn’t called till line 8, after 'buttonRotation" has a value.
If I move the variable declarations above the function then I don’t get an error. [import]uid: 295 topic_id: 1356 reply_id: 301356[/import]