From c70d5a9773a927b46793ea6ad6f0ff87a485259f Mon Sep 17 00:00:00 2001 From: GoldenTails <milestailsprower101n2@gmail.com> Date: Thu, 5 Nov 2020 18:12:35 -0600 Subject: [PATCH] Make `mapmusflags` and `mapmusname` writable. --- src/lua_script.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lua_script.c b/src/lua_script.c index 29ee094d9e..c0e31557ec 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -399,6 +399,21 @@ int LUA_CheckGlobals(lua_State *L, const char *word) if (player) displayplayer = player - players; } + else if (fastcmp(word, "mapmusname")) + { + size_t strlength; + const char *str = luaL_checkstring(L, 2, &strlength); + + if (strlength > 6) + return luaL_error(L, "string length out of range (maximum 6 characters)"); + + if (strlen(str) < strlength) + return luaL_error(L, "string must not contain embedded zeros!"); + + strncpy(mapmusname, str, strlength); + } + else if (fastcmp(word, "mapmusflags")) + mapmusflags = (UINT16)luaL_checkinteger(L, 2); else return 0; -- GitLab