Remove string size limit for script.Source in plugins?

I’m trying to edit all my script’s sources and I have one script that is 280k character long. Even if I removed all comments and pointlessly moved what I could to modulescripts, it would still be ~230k, and I’m still adding to it. Could plugins be allowed to edit script sources beyond a string limit of 200k?

13 Likes

Out of curiosity, where is this problem occurring? Is it the Source property that limits this or something about Lua? I’d imagine it has to do with the Source property, but I don’t understand why that would have a max cap that would be different than what you could actually write within the script.

And so I agree with your request. But perhaps design your systems so that your scripts aren’t so huge?

I’ve ran into this problem before aswell, there are definitely certain situations where you require that many characters…

Do you use tabbed indentation or spaced indentation? Just checking since I write all my code in N++ then port over to Studio, and I set N++ to do 4 spaces to indent for if I need to share the code anywhere.

Roblox doesnt like properties being set by scripts past 200k. Same for stringvalues.

I cant really change the system now, and I dont know how I would have done it differently. Its fairly efficient as it is, there’s just massive amounts of code, nearly all of it using global scope variables. Couldnt separate more than a handful of tiny functioms

I use no indentation(I know I know)
I script on roblox itself, I just want to edit all of my scripts sources at once. I couldnt even do script.Source=script.Source … “a” if the source was past 200k

You can’t indeed set a stringvalue with a string that’s longer than 200k characters.
This is because when the property change replicates to other clients, they get disconnected.
Not that this would be a problem for a plugin in studio… they just never thought about that.

2 Likes

That would explain why my clients crash sometimes. Still would be neat to have this power. If a script can be past 200k manually, might as well allow from scripts on the plugin level too.

Allowing the Source property to have a longer value would be nice.
Sources of scripts don’t replicate that much, and it can’t be set online anyway.
(Even if an exploiter sets it, it doesn’t replicate. If it does, he/she just gets disconnected)

How many lines is your script?

328,284 characters now, 13.8k lines for the gamescript.

It’s easier for me to comprehend the size of a script by line number rather than character count.

That’s huge, I’ve never written a single script longer than a few thousand lines. By that point it’s extremely difficult to keep it straight in my head. ModuleScripts are beyond useful.

I’ll look into modulescripts soon, but it’s working pretty well for me as it is. Maybe it’s because I work with my code nearly daily and the game isn’t very old so it’s all pretty fresh in my head.

After 4 years of waiting and this arbitrary limit is still an issue, our scripts can be as long as we want but why can’t we access it via .Source?

2 Likes

Source should be an array of lines, not a single string anyway. The property seems like a very cut-and-stitch thing that was added in last minute to satisfy plugin developers.

So instead of

Script.Source = "function foo() return \"bar\" end print(foo())"

It would be stored as

Script.Source = {
  "function foo()",
  "return \"bar\"",
  "end",
  "print(foo())"
}

And anyway, there is no reason why a server script would ever need to replicate to the client.

If you were asking me for an actual solution, i’d say it behave like io.lines from vanilla lua, something like

for lineNumber, line in script:GetLines() do
  print(lineNumber, line)
end
6 Likes