From b2571d6e76c2520943c27eafaf7447c499177215 Mon Sep 17 00:00:00 2001 From: Tracer <43095317+TracerDS@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:48:12 +0100 Subject: [PATCH] Rebased branch --- Shared/mods/deathmatch/logic/lua/CLuaShared.cpp | 1 + .../deathmatch/logic/luadefs/CLuaPathDefs.cpp | 16 ++++++---------- .../mods/deathmatch/logic/luadefs/CLuaPathDefs.h | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp b/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp index 79bf7e5465..2b83816e1c 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp @@ -86,6 +86,7 @@ void CLuaShared::LoadFunctions() void CLuaShared::AddClasses(lua_State* luaVM) { CLuaFileDefs::AddClass(luaVM); + CLuaPathDefs::AddClass(luaVM); CLuaXMLDefs::AddClass(luaVM); } diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.cpp index b4fbb2bc31..7eaafdbbd0 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.cpp @@ -37,13 +37,9 @@ void CLuaPathDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); -#ifdef MTA_CLIENT - lua_classfunction(luaVM, "listDir", CLuaPathDefs::pathListDir); -#else - lua_classfunction(luaVM, "listDir", "pathListDir", CLuaPathDefs::pathListDir); -#endif - lua_classfunction(luaVM, "isFile", CLuaPathDefs::pathIsFile); - lua_classfunction(luaVM, "isDirectory", CLuaPathDefs::pathIsDirectory); + lua_classfunction(luaVM, "listDir", "pathListDir"); + lua_classfunction(luaVM, "isFile", "pathIsFile"); + lua_classfunction(luaVM, "isDirectory", "pathIsDirectory"); lua_registerclass(luaVM, "path"); } @@ -66,7 +62,7 @@ std::optional> CLuaPathDefs::pathListDir(lua_State* lua return SharedUtil::ListDir(strAbsPath); } -bool CLuaPathDefs::isFile(lua_State* luaVM, std::string path) +bool CLuaPathDefs::pathIsFile(lua_State* luaVM, std::string path) { CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM); if (!pLuaMain) @@ -81,7 +77,7 @@ bool CLuaPathDefs::isFile(lua_State* luaVM, std::string path) return SharedUtil::FileExists(strAbsPath); } -bool CLuaPathDefs::isDirectory(lua_State* luaVM, std::string path) +bool CLuaPathDefs::pathIsDirectory(lua_State* luaVM, std::string path) { CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM); if (!pLuaMain) @@ -94,4 +90,4 @@ bool CLuaPathDefs::isDirectory(lua_State* luaVM, std::string path) return false; return SharedUtil::DirectoryExists(strAbsPath); -} \ No newline at end of file +} diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.h b/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.h index 0ee5d4edf5..cfc8ae1bae 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.h +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.h @@ -11,7 +11,7 @@ #pragma once #include "luadefs/CLuaDefs.h" -class CLuaFileDefs : public CLuaDefs +class CLuaPathDefs : public CLuaDefs { public: static void LoadFunctions();