This is highlighted in release notes for 428 but it’s worth a separate announcement.
TL;DR: Make sure your functions with hundreds of local variables still work in Studio, before they break in live games!
A bug report ("Out of registers when trying to allocate 4 registers: exceeded limit 255" What does it mean?) highlighted a small issue in Luau compiler that existed since we launched Luau last year - instead of enforcing the limit of 200 locals, the compiler enforced the limit of 255 locals. Which means that you could use 210 locals in Luau VM.
This is problematic because 255 also happens to be the limit for temporary registers. If you use, say, 250 local variables, the remaining expressions in your function only get up to 5 registers. At this point even simple expressions may run out of registers when compiling your code.
This doesn’t seem like a big problem, but it actually makes your code very fragile - not only can small changes in your own code lead to the code no longer compiling (as was witnessed by the bug report), but also small changes in our compiler can lead to your code not compiling anymore!
Because of this, we fixed this problem and now the limit of 200 locals is enforced correctly. We also helpfully point the compiler error when running out of any limited quantity (200 locals, 200 upvalues, 255 registers, 5 packs of chicken legs) to the correct location in source.
Just to be clear - these limits are per function. As long as each individual function conforms to these limits, it doesn’t matter how many functions you have in your script (apart from your own comfort when working with that code).
However, it’s possible that some of you have accidentally written code in the last few months that uses more than 200 locals. This code will become invalid as a result of this change and will refuse to compile.
Code like this was not valid in old Lua VM, but it was valid in Luau VM up until now.
This change is currently active in Studio, but not in live games. So if any of you have scripts with lots and lots and lots of locals, please check that Studio can still run them correctly and adjust the scripts if necessary to use fewer locals.
The change will go in effect in live games next week.