From ac5fa93e36c5efc2f14eeab7029d89b71ced291a Mon Sep 17 00:00:00 2001
From: Lighto97 <lighto97@outlook.com>
Date: Wed, 12 Mar 2025 04:02:09 -0300
Subject: [PATCH 1/2] expose map thumbnail and minimap to lua, read-only

---
 src/lua_maplib.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/lua_maplib.c b/src/lua_maplib.c
index 89b2e7c4c..43ac02c61 100644
--- a/src/lua_maplib.c
+++ b/src/lua_maplib.c
@@ -2572,6 +2572,24 @@ static int mapheaderinfo_get(lua_State *L)
 		lua_pushfixed(L, header->mobj_scale);
 	else if (fastcmp(field, "gravity"))
 		lua_pushfixed(L, header->gravity);
+	else if (fastcmp(field, "thumbnail"))
+	{
+		patch_t *tnpatch = header->thumbnailPic;
+
+		if (!tnpatch)
+			tnpatch = W_CachePatchName("BLANKLVL", PU_PATCH);
+
+		LUA_PushUserdata(L, tnpatch, META_PATCH);
+	}
+	else if (fastcmp(field, "minimap"))
+	{
+		patch_t *mmpatch = header->minimapPic;
+
+		if (!tnpatch)
+			mmpatch = W_CachePatchName("BLANKLVL", PU_PATCH);
+
+		LUA_PushUserdata(L, mmpatch, META_PATCH);
+	}
 	else {
 		// Read custom vars now
 		// (note: don't include the "LUA." in your lua scripts!)
-- 
GitLab


From d9828992afbbc2f05878401ed4514be9714282c5 Mon Sep 17 00:00:00 2001
From: Lighto97 <lighto97@outlook.com>
Date: Wed, 12 Mar 2025 04:14:48 -0300
Subject: [PATCH 2/2] fix typo, mmpatch not tnpatch

---
 src/lua_maplib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lua_maplib.c b/src/lua_maplib.c
index 43ac02c61..4b3df1bd6 100644
--- a/src/lua_maplib.c
+++ b/src/lua_maplib.c
@@ -2585,7 +2585,7 @@ static int mapheaderinfo_get(lua_State *L)
 	{
 		patch_t *mmpatch = header->minimapPic;
 
-		if (!tnpatch)
+		if (!mmpatch)
 			mmpatch = W_CachePatchName("BLANKLVL", PU_PATCH);
 
 		LUA_PushUserdata(L, mmpatch, META_PATCH);
-- 
GitLab