From d4eff00234dc55dac4cb86b6187f5607c1254f9b Mon Sep 17 00:00:00 2001 From: Roberto I Date: Wed, 29 Oct 2025 13:14:48 -0300 Subject: Fixed initialization of global variables When calling 'luaK_storevar', the 'expdesc' for the variable must be created before the one for the expression, to satisfy the assumptions for register allocation. So, in a statement like 'global a = exp', where 'a' is actually '_ENV.a', this variable must be handled before the initializing expression 'exp'. --- lcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lcode.c') diff --git a/lcode.c b/lcode.c index 429d4f80..7c63abb2 100644 --- a/lcode.c +++ b/lcode.c @@ -1242,7 +1242,7 @@ static void codenot (FuncState *fs, expdesc *e) { ** Check whether expression 'e' is a short literal string */ static int isKstr (FuncState *fs, expdesc *e) { - return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_B && + return (e->k == VK && !hasjumps(e) && e->u.info <= MAXINDEXRK && ttisshrstring(&fs->f->k[e->u.info])); } -- cgit v1.2.3-55-g6feb