5kb limit on lua scripts?

Never ran into this issue before (been a couple years, but I used to be a decently active developer, if a bit inactive on FP), but it seems like there’s a 5kb limit on lua scripts on my new development server. Is there a convar that I’m missing that dictates a maximum size, or is there something really weird going on?

For reference, I’m 99% sure there’s a maximum size because the scripts work perfectly fine as long as they are under 5kb, but I start running into things like “expected ) near eof” when I add spaces or comments, and the it stops working at exactly 5kb.

nope sv_commands.lua from DarkRP is 14 Kb, you just have a syntax error.

Trust me, it’s not a syntax error. Again, it compiles perfectly fine as long as the file is under 5kb. But if I add enough spaces to push it over 5kb, it fails to compile saying that it’s missing symbols that are at the end of the file.

[editline]30th December 2016[/editline]

This compiles just fine, whereas this does not

The only difference is the extra whitespace at line 80, which pushes it exactly to 5kb

The error it receives on the second one is

[ERROR] addons/grapple/lua/sh_grapple_shared.lua:152: ')' expected (to close '(' at line 107) near '<eof>'
  1. unknown - addons/grapple/lua/sh_grapple_shared.lua:0

That closing parenthesis is the last character, which gets cut off by apparent the 5kb limit

Does the script actually run successfully even though the error message appears?

I haven’t tested that extensively. In this case, theoretically, everything but the hook would run correctly, but since it’s erroring while calling hook.Add, that FinishMove would never get called. So lua refreshes would work fine, but a full reload (changelevel or server restart) would fail.

It isn’t isolated to this script however. It’s a mostly clean server, except for exsto and a couple of my own addons, and the one I’m working on right now. So far I’ve noticed it in all of the scripts in this addon and have just been kind of working around it through the day today. But at this point, it’s getting really fucking annoying, so I figured I’d ask you guys to see if there was a convar or something which might be set incorrectly.

[editline]30th December 2016[/editline]

Okay, so it seems like only lua refresh is failing. Normal loading is unaffected. It’s also not a networking issue (which was my first though) because it hits the cap on the server as well as the client.

None of it would be ran because it’s a compile error, not a runtime error. Anyways, it’s just as I suspected. It’s this fucking thing again. You are not alone.


It’s annoying, yes, but I don’t think there’s a way to solve it. What OS is your server on, by the way?

It’s a digital ocean VPS on Ubuntu 12.04.5 LTS. Good to know I’m not insane lol

Used to run a Windows server and this issue never happened, maybe it’s exclusive to linux? If that’s the case, it should be possible to write a binary module that emulates the functionality without the stupid filesize limit.

[editline]30th December 2016[/editline]

It’s really interesting that it only fails when the file is >= 5kb. That might be worth looking into.

It happened to me on Linux as well. Never experienced this on Windows.

I’ve created an issue here for it.

For anyone who wants to know about this, it seems like it has to do with copying files via FTP and having auto refresh detect the partial write. In my case, it writes the files 5kb at a time. It does a second update after erroring the first time, so it’s really just an inconvenience in that it shows a false error. Thus, marking the thread as solved.