Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

:1405: main function has more than 200 local variables? [closed]

Asked by 5 years ago

So I'm working on editing a script and when i try to run it it says : :1405: main function has more than 200 local variables. How do I fix this? P.S. i can't put the script in a code block because of how huge it is

0
Can you share a portion of your code? For example, maybe some of where you're defining all your local variables? We can give suggestions on how to cut down the number. BlueTaslem 18071 — 5y

Closed as Too Broad by User#24403

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago

Source: http://lua.2524044.n2.nabble.com/main-function-has-more-than-200-local-variables-td3080987.html

Local variables are a limited resource. Due to the structure of the VM bytecode, and a few other things, a function cannot have more than 256 local variables. In practice, the limit is reduced down to 200, though it can probably be raised to 240 or 250 without too many issues. Local variables are intended to be variables though, not named constants. I would suggest either placing the constants into a table, or modifying the parser to accept named constants in a way similar to C's "#define CONSTANT value".

Ad