Attempt to call method 'insert' (a nil value)

Here is a weird bug that I occur, I Know my code works cause there is a chance that the error doesn’t occur

here is my code:

-- if resultHere ~= nil then resultHere = display.newImageRect("Assets/imgOpSuccess.png",285,110) resultHere.anchorY = 0 resultHere.x = centerX resultHere.y = 295 -- end if resultHere == nil then print("rsHere is nil") end if sceneGroup == nil then print("sceneGroup is nil") end -- if resultHere ~= nil then envelopeHere = display.newImageRect("Assets/imgEnvelope.png",285,150) envelopeHere.anchorY = 0 envelopeHere.x = centerX envelopeHere.y = 295 resultHere.y = 295 -- end b = b + 1 print(b) if resultHere ~= nil then sceneGroup:insert(resultHere) end if envelopeHere ~= nil then sceneGroup:insert(envelopeHere) end

Whenever this occurs, it always says that it has a nil variable. Where as there are no nil variables

SOLVED: I just added a another sceneGroup(self.view) so I changed sceneGroup to scGroup and on the create part of the composer I added “scGroup = self.view”. I think this still occurs on the LUA limitation where only less than 60 variables can be inserted in a function.

SOLVED: I just added a another sceneGroup(self.view) so I changed sceneGroup to scGroup and on the create part of the composer I added “scGroup = self.view”. I think this still occurs on the LUA limitation where only less than 60 variables can be inserted in a function.