Error: More than 60 upvalues?

Hello! I’ve started receiving an error… It says: “function at line 1722 has more than 60 upvalues”. I checked the function at line 1722, and it’s my largest function in the code. It’s the pause function and it contains lots of smaller functions in it, if I remove one of these nested functions the code works, but if I add it back it gives me the error again…

Is there any way to solve this? I can’t remove any of the functions in there, it will ruin the game…

Thanks in advance, [import]uid: 14018 topic_id: 9279 reply_id: 309279[/import]

Whenever I get that, it’s from missing an “end” at the bottom of the function [import]uid: 14032 topic_id: 9279 reply_id: 33854[/import]

@Vandano, it’s not that because if I remove two if-statements from the pause function it suddenly works again… [import]uid: 14018 topic_id: 9279 reply_id: 33857[/import]

I have the same errors, could someone help? !

As Vandano said, if I remove someline within it ( less than 60) it works… where is the limits from?
Thanks
[import]uid: 63983 topic_id: 9279 reply_id: 38309[/import]

60 is an internal limit in Lua itself.

This World of Warcraft thread has a good discussion on this:
http://wow.incgamers.com/forums/showthread.php?t=414407
[import]uid: 7563 topic_id: 9279 reply_id: 38310[/import]

For a workaround to the original problem, I would suggest either making some of your functions global, or possibly putting some of your functions inside a common local table (so the table will only count as 1 upvalue).
[import]uid: 7563 topic_id: 9279 reply_id: 38312[/import]

@ewing Thanks for the link, really enlightening! [import]uid: 70635 topic_id: 9279 reply_id: 47053[/import]

Totally enlightening! I now see the need for sparingly use forward declarations. [import]uid: 67217 topic_id: 9279 reply_id: 53605[/import]