Are there any limitations/length for scripts?

I’m currently checking if I can adapt my script into a global script (so far I think it’s possible).

It’s currently over 600 lines and since I have plenty of features to built in, I think it will grow to 1,000 or probably upto 5,000 lines.

My question is, are there any limitations regarding length in bytes or lines or any limitations I should know of, or maybe some stack size I should know of? I would not like it if I’m at e.g. 2,000 lines knowing I cannot extend the script anymore.

Btw, so far I really like the scripting language (I miss a bit a ‘search’ function, but I also understand that I’m quite ‘misusing’ the scripting language intention).

There are no artificial limits to code size and the stack size should be sufficiently large since there’s no recursion allowed and presumably you won’t have functions with thousands of parameters.

Personally, I’ve never needed nor written a script that is more than 40-50 lines so I have no experience with large scripts (yeah, I know, I designed that language but my use case was for simple MIDI transformations and to test ideas that could later be integrated into the GUI, something that has happened quite often).

However, I believe some users have written some really massive programs with GP Script with many thousands of lines and I haven’t heard of any issues.

Glad to hear it :slight_smile:

I’m not sure what you’re trying to do however and I wonder if you might want to consider writing your stuff in C++ (or any language that can handle extern “C” headers) using the extensions SDK that was added to GP4. You can even implement code that’s callable from GP Script functions that you provide in your extension



Thanks for the elaborated answer.

And indeed, I’m not going to use many parameters (I use a bunch of ‘global variables’ though)

Good to hear I’m not the only one writing so long scripts (but everything is relative).

I heard about extensions indeed, but haven’t looked into it much to be honest. I think debugging will be a bit harder for code that interacts with widgets (which in my case is). However, I’m also need some kind of parser, so maybe in the future that will be a good part to be moved to an extension (called by the script).

Because I had to repeat x-times the same pieces of code for several widgets (e.g. mixer slices) I had a code of more than 2500 lines. But with the GPScript improvements in GP4 the same code reduced to about 600 lines. But the length of the code was never an issue for GP.

1 Like

I think we might have similar ‘requirements’, I’m already at 600 lines :slight_smile: But good to hear I don’t have to expect any issues in the size/length of the script. And with extensions I could even reduce a lot eventually.