From e6d51750bd277f93780e3556b6528b38ec655750 Mon Sep 17 00:00:00 2001
From: Skydusk <lightacecz@gmail.com>
Date: Fri, 21 Feb 2025 22:41:21 +0000
Subject: [PATCH] Get the filename with pointer arithmetic instead.

-- Lactozilla's change
---
 src/lua_consolelib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c
index 51ade04631..34f1affc51 100644
--- a/src/lua_consolelib.c
+++ b/src/lua_consolelib.c
@@ -585,8 +585,8 @@ static int lib_cvRegisterVar(lua_State *L)
 	{
 		if (!category)
 		{
-			char* temp = strdup(wadfiles[numwadfiles - 1]->filename);
-			nameonly(temp);
+			char* temp = wadfiles[numwadfiles - 1]->filename;
+			temp += strlen(temp) - nameonlylength(temp);
 
 			category = temp;
 		}
-- 
GitLab