From dd554d880b99d5abed06a1f634daf1265f6b600c Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Fri, 6 Jun 2025 03:28:52 +0300
Subject: [PATCH 90/90] Update included lua to version 5.4.8

See RM #1431

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 dependencies/lua-5.4/README          | 2 +-
 dependencies/lua-5.4/Version.txt     | 8 +++-----
 dependencies/lua-5.4/doc/readme.html | 8 ++++----
 dependencies/lua-5.4/src/lapi.c      | 2 +-
 dependencies/lua-5.4/src/ldo.c       | 1 +
 dependencies/lua-5.4/src/lparser.c   | 5 ++---
 dependencies/lua-5.4/src/lua.h       | 8 ++++----
 7 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/dependencies/lua-5.4/README b/dependencies/lua-5.4/README
index fe99b874f6..b251d296f6 100644
--- a/dependencies/lua-5.4/README
+++ b/dependencies/lua-5.4/README
@@ -1,5 +1,5 @@
 
-This is Lua 5.4.7, released on 13 Jun 2024.
+This is Lua 5.4.8, released on 21 May 2025.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.
diff --git a/dependencies/lua-5.4/Version.txt b/dependencies/lua-5.4/Version.txt
index 4ef3b8b046..d61b859e28 100644
--- a/dependencies/lua-5.4/Version.txt
+++ b/dependencies/lua-5.4/Version.txt
@@ -1,10 +1,8 @@
-Sources here are from lua-5.4.7
-(http://www.lua.org/ftp/lua-5.4.7.tar.gz)
+Sources here are from lua-5.4.8
+(http://www.lua.org/ftp/lua-5.4.8.tar.gz)
 
 Upstream bug fixes from https://www.lua.org/bugs.html applied:
-2, 3, 5, 6, 7, 8
-Upstream bug fixes not applicable to our tree:
-1
+
 
 Not entire lua distribution directory hierarchy is included here, and
 some files needed for Freeciv usage have been added.
diff --git a/dependencies/lua-5.4/doc/readme.html b/dependencies/lua-5.4/doc/readme.html
index 3bcefadfe9..a4eb59dd38 100644
--- a/dependencies/lua-5.4/doc/readme.html
+++ b/dependencies/lua-5.4/doc/readme.html
@@ -109,7 +109,7 @@ Here are the details.
 <OL>
 <LI>
 Open a terminal window and move to
-the top-level directory, which is named <TT>lua-5.4.7</TT>.
+the top-level directory, which is named <TT>lua-5.4.8</TT>.
 The <TT>Makefile</TT> there controls both the build process and the installation process.
 <P>
 <LI>
@@ -302,7 +302,7 @@ For details, see the
 <A HREF="https://www.lua.org/license.html">license page</A>.
 
 <BLOCKQUOTE STYLE="padding-bottom: 0em">
-Copyright &copy; 1994&ndash;2024 Lua.org, PUC-Rio.
+Copyright &copy; 1994&ndash;2025 Lua.org, PUC-Rio.
 
 <P>
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -329,10 +329,10 @@ THE SOFTWARE.
 
 <P CLASS="footer">
 Last update:
-Wed May  8 21:56:16 UTC 2024
+Wed May 21 21:12:01 UTC 2025
 </P>
 <!--
-Last change: revised for Lua 5.4.7
+Last change: revised for Lua 5.4.8
 -->
 
 </BODY>
diff --git a/dependencies/lua-5.4/src/lapi.c b/dependencies/lua-5.4/src/lapi.c
index 332e97d169..04e09cff7e 100644
--- a/dependencies/lua-5.4/src/lapi.c
+++ b/dependencies/lua-5.4/src/lapi.c
@@ -1343,7 +1343,7 @@ void lua_warning (lua_State *L, const char *msg, int tocont) {
 LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) {
   Udata *u;
   lua_lock(L);
-  api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value");
+  api_check(L, 0 <= nuvalue && nuvalue < SHRT_MAX, "invalid value");
   u = luaS_newudata(L, size, nuvalue);
   setuvalue(L, s2v(L->top.p), u);
   api_incr_top(L);
diff --git a/dependencies/lua-5.4/src/ldo.c b/dependencies/lua-5.4/src/ldo.c
index 365e84f595..90f98f8d8a 100644
--- a/dependencies/lua-5.4/src/ldo.c
+++ b/dependencies/lua-5.4/src/ldo.c
@@ -116,6 +116,7 @@ l_noret luaD_throw (lua_State *L, int errcode) {
   else {  /* thread has no error handler */
     global_State *g = G(L);
     errcode = luaE_resetthread(L, errcode);  /* close all upvalues */
+    L->status = errcode;
     if (g->mainthread->errorJmp) {  /* main thread has a handler? */
       setobjs2s(L, g->mainthread->top.p++, L->top.p - 1);  /* copy error obj. */
       luaD_throw(g->mainthread, errcode);  /* re-throw in main thread */
diff --git a/dependencies/lua-5.4/src/lparser.c b/dependencies/lua-5.4/src/lparser.c
index aebddaf70b..1ac82990e0 100644
--- a/dependencies/lua-5.4/src/lparser.c
+++ b/dependencies/lua-5.4/src/lparser.c
@@ -849,12 +849,11 @@ static void recfield (LexState *ls, ConsControl *cc) {
   FuncState *fs = ls->fs;
   int reg = ls->fs->freereg;
   expdesc tab, key, val;
-  if (ls->t.token == TK_NAME) {
-    checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
+  if (ls->t.token == TK_NAME)
     codename(ls, &key);
-  }
   else  /* ls->t.token == '[' */
     yindex(ls, &key);
+  checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
   cc->nh++;
   checknext(ls, '=');
   tab = *cc->t;
diff --git a/dependencies/lua-5.4/src/lua.h b/dependencies/lua-5.4/src/lua.h
index f050dac091..f3ea590d9c 100644
--- a/dependencies/lua-5.4/src/lua.h
+++ b/dependencies/lua-5.4/src/lua.h
@@ -18,14 +18,14 @@
 
 #define LUA_VERSION_MAJOR	"5"
 #define LUA_VERSION_MINOR	"4"
-#define LUA_VERSION_RELEASE	"7"
+#define LUA_VERSION_RELEASE	"8"
 
 #define LUA_VERSION_NUM			504
-#define LUA_VERSION_RELEASE_NUM		(LUA_VERSION_NUM * 100 + 7)
+#define LUA_VERSION_RELEASE_NUM		(LUA_VERSION_NUM * 100 + 8)
 
 #define LUA_VERSION	"Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
 #define LUA_RELEASE	LUA_VERSION "." LUA_VERSION_RELEASE
-#define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2024 Lua.org, PUC-Rio"
+#define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2025 Lua.org, PUC-Rio"
 #define LUA_AUTHORS	"R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
 
 
@@ -497,7 +497,7 @@ struct lua_Debug {
 
 
 /******************************************************************************
-* Copyright (C) 1994-2024 Lua.org, PUC-Rio.
+* Copyright (C) 1994-2025 Lua.org, PUC-Rio.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
-- 
2.47.2

