From 59a1adf194efe43741c2bb2005d93d8320a19d14 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 1 Jul 2025 10:57:02 -0300 Subject: LUAI_MAXSTACK defined privately LUAI_MAXSTACK is limited to INT_MAX/2, so can use INT_MAX/2 to define pseudo-indices (LUA_REGISTRYINDEX) in 'lua.h'. A change in the maximum stack size does not need to change the Lua-C ABI. --- lua.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua.h') diff --git a/lua.h b/lua.h index 95e0db32..131a8fcb 100644 --- a/lua.h +++ b/lua.h @@ -37,10 +37,10 @@ /* ** Pseudo-indices -** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty -** space after that to help overflow detection) +** (The stack size is limited to INT_MAX/2; we keep some free empty +** space after that to help overflow detection.) */ -#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) +#define LUA_REGISTRYINDEX (-(INT_MAX/2 + 1000)) #define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) -- cgit v1.2.3-55-g6feb