From 720771a7239893c620e5f0e5efbf87ff5fa971fd Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sun, 6 Sep 2026 21:04:47 -0700 Subject: [PATCH] AP_Scripting: Revert "Reduce lua stack usage" This reverts commit 6e7367b86fabe173f26f38f0cc1490ed5bc289ec. These reductions reduce the usage of the Lua stack, which is stored in the heap. This reverts back to the stock Lua values; some complex scripts may desire extra locals. There is some increased risk of memory fragmentation and so forth but presumably such scripts are prepared. The actual C stack depth can be limited by `LUAI_MAXCCALLS`. --- libraries/AP_Scripting/lua/src/lfunc.h | 2 +- libraries/AP_Scripting/lua/src/lparser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Scripting/lua/src/lfunc.h b/libraries/AP_Scripting/lua/src/lfunc.h index ec7fd3df388..c916e9878ad 100644 --- a/libraries/AP_Scripting/lua/src/lfunc.h +++ b/libraries/AP_Scripting/lua/src/lfunc.h @@ -26,7 +26,7 @@ ** maximum number of upvalues in a closure (both C and Lua). (Value ** must fit in a VM register.) */ -#define MAXUPVAL 127 +#define MAXUPVAL 255 /* diff --git a/libraries/AP_Scripting/lua/src/lparser.c b/libraries/AP_Scripting/lua/src/lparser.c index 2dbbb13fd1f..2f41e00b803 100644 --- a/libraries/AP_Scripting/lua/src/lparser.c +++ b/libraries/AP_Scripting/lua/src/lparser.c @@ -31,7 +31,7 @@ /* maximum number of local variables per function (must be smaller than 250, due to the bytecode format) */ -#define MAXVARS 100 +#define MAXVARS 200 #define hasmultret(k) ((k) == VCALL || (k) == VVARARG)