Error function has more than 60 upvalues

Hi
Why this issue appear?
Cant use more than 60 variables per function?

the error
“function at line 353 has more than 60 upvalues” [import]uid: 26056 topic_id: 21785 reply_id: 321785[/import]

Hey, @Blickon, take a look at this post. This should help.

http://developer.anscamobile.com/forum/2011/12/10/runtime-error-function-has-more-60-upvalues

Naomi [import]uid: 67217 topic_id: 21785 reply_id: 86504[/import]

Thanks for the help Naomi. it is what i was thinking, i declare all the variables of objects on the top, and then separe the all code of gameplay on some different function, and then run this functions and it works great and resolve the problem :slight_smile: [import]uid: 26056 topic_id: 21785 reply_id: 86506[/import]

generally there would be a missing end and a couple of functions in between. [import]uid: 3826 topic_id: 21785 reply_id: 86507[/import]

yeh, maybe one of the best solution is:

function new()  
  
--variables  
  
Function1()  
---Code with functions etc inside  
end  
  
Function2()  
---Code with functions etc inside  
end  
.  
.  
.  
  
--Final Function  
Final Function()  
 Function1()  
 Function2()  
end  
  
--and then run the Final function   
Final Function()  
  
end  
  

:slight_smile: [import]uid: 26056 topic_id: 21785 reply_id: 86513[/import]

I know this topic is cold and old but I will revive just so people will see if searching. I see this question asked a lot and it can be frustrating but very simple to fix.

I would like to second this answer.

Before going off and re-arraging your variables, try adding/removing an extra ‘end’ to the end of the function and see if that works. If so, then work your way from the top down until you find where you missed putting one in the first place.

C [import]uid: 26289 topic_id: 21785 reply_id: 106982[/import]