more than 60 upvalues

I’m getting the more than 60 upvalues error when my code is like this-
I’m getting this error in levels I have a lot of stuff with collisions. It works in levels with just a few items

 local createLevel = function()  
  
 -- has level objects and start and reset level functions  
   
  
 function startListening()   
 --has collision detections  
  
 end  
 end  

When I change my code to the following, were I moved the startListening function outside the createlevel function, it works, but I get- attempt to index global ‘safe1’ < a nil value > in line 17 in this example. My ‘safe1’ is actually the second collision in the startListening function and the safe is defined as local in the createLevel function. The fist collision is the link[1] and that isn’t giving the error.

 local createLevel = function()  
  
 local safe1 = movieclip.newAnim{ "imagesGame/safe.png", "imagesGame/safe2.png" }  
 game:insert( safe1 )  
 safe1.x = 930; safe1.y = 0  
 physics.addBody( safe1, { density=1.0, friction=0.5, bounce=.04} )  
 safe1.myName = "safe"   
 -- has level objects   
   
 end  
 function startListening()   
  
 if link[1].postCollision then  
 return  
 end  
  
 if safe1.postCollision then  
 return  
 end  
 --has collision detections  
  
 end  

Now I removed all the local… from my objects in createLevel function, now I don’t get the error, but the collisions don’t work.

Dan [import]uid: 78446 topic_id: 15616 reply_id: 315616[/import]

Predeclare safe1 :

[code]

local safe1

local createLevel = function()

safe1 = movieclip.newAnim{ “imagesGame/safe.png”, “imagesGame/safe2.png” }
game:insert( safe1 )
safe1.x = 930; safe1.y = 0
physics.addBody( safe1, { density=1.0, friction=0.5, bounce=.04} )
safe1.myName = “safe”
– has level objects

end
function startListening()

if link[1].postCollision then
return
end

if safe1.postCollision then
return
end
–has collision detections

end

[/code] [import]uid: 84637 topic_id: 15616 reply_id: 57669[/import]

Thanks that was it, I missed that one. Figures it was something simple.

Dan [import]uid: 78446 topic_id: 15616 reply_id: 57678[/import]