Compilation failure: function on_message has more than 60 upvalues (solved)

I am a bit at a loss:
I have a script that receives quite a few messages, 25 in total. When I try to add another one, compilation fails with this error:

/main/controls.gui_script
	Line 310: Compilation failed: function at line 201 has more than 60 upvalues

I just cannot find these 60 upvalues. Has someone an idea where I should look and what I could try next?

It seems you hit one of Lua’s limits.
The first google:

2 Likes

Many thanks, Mathias! The script has quite a lot of variables and functions, so I’d better try and make the script more compact then, right?
Just answered my own question: if I comment out some functions, compilation is successful. Off to rewrite my code then.

2 Likes