lua-users home
lua-l archive

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


Hi, list

As per the documentation(https://www.lua.org/pil/24.2.1.html),
which says that [emphasise mine]:
When Lua starts and any time that Lua calls C, the stack has at least 20
**free slots** (this constant is defined as LUA_MINSTACK in lua.h). This is
          ^^^^
more than enough for most common uses, so usually we do not even think
about that. However, some tasks may need more stack space (e.g., for
calling a function with a variable number of arguments).

What does "slot" mean for Lua?
I guess it is Tagged Values(i.e struct TValue) since there is a hint on
http://lua-users.org/wiki/FastStringPatc, which says that:
Lua stores all objects in tagged value slots on the Lua stack or in
Lua tables. These slots are usually 12 or 16 bytes long (depending
on the architecture and the type of lua_Number). The size is
dominated by the requirement to store properly aligned pointers and
lua_Number's. The tag itself is a small integer and easily fits into
a single byte. That leaves us either 11 or 15 bytes of free space
that can be put to good use.

Please let me know if I miss something.

Best regards
Sunshilong