Is there a way to bypass the character limit when calling .source on a script? I want to make a script (that I paste into command line) that downloads code from a Github repo, but I know if I do .Source = code it would eventually error with the 200K character limit
I’m wondering if it’s possible to bypass this, as I remember reading about it a few years ago, but I forgot where I read it
According to a few online sources I found it seems that in most cases “bypassing” means removing parts of the code like for example the word local before variables and figuring out methods of making the result shorter without changing the code behavior(like changing the variable names to the smallest possible given the usable charset and syntax rules).
I also found that the limit of 200000-1 is a limit of string properties in general, you can test that with StringValue.Value for example.
It’s called minifying the code. The technique is very popular in web development circles with CDN sources like jQuery, Bootstrap, and React because it can reduce the amount of code by 2/3’s which is a significant savings for storage and network bandwidth.
I just did a Google search for “LUA Minifier” and a whole bunch of things popped up.
A possible bypass could be using ScriptEditorService to open the script and use ScriptDocument: EditTextAsync() to add to the script without using script.Source in the first place. Though seeing that you are talking about more than 200k characters worth of code, that might get a little laggy since the script has to actually be open.