lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2014-04-08 5:22 GMT+02:00 Coroutines <coroutines@gmail.com>:

> The limit for Lua 5.1, 5.2 and LuaJIT is 200 locals per scope
> (I haven't tried Lua 5.3).  And it's not a simple change of the codebase
> to increase the number of locals.

> 1) I belive the 'local limit' is 256.

That is the hard limit imposed by the design of the VM,
which stores locals on a 256-slot virtual stack that
is used for other stuff too.

The number of locals that a programmer may define is 200.

>From llimits.h:

~~~
* maximum number of local variables per function (must be smaller
   than 250, due to the bytecode format) */
#define MAXVARS         200
~~~