Skip to content

Commit

Permalink
Rebased branch
Browse files Browse the repository at this point in the history
  • Loading branch information
TracerDS committed Feb 5, 2024
1 parent db8018a commit b2571d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions Shared/mods/deathmatch/logic/lua/CLuaShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void CLuaShared::LoadFunctions()
void CLuaShared::AddClasses(lua_State* luaVM)
{
CLuaFileDefs::AddClass(luaVM);
CLuaPathDefs::AddClass(luaVM);
CLuaXMLDefs::AddClass(luaVM);
}

Expand Down
16 changes: 6 additions & 10 deletions Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -66,7 +62,7 @@ std::optional<std::vector<std::string>> 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)
Expand All @@ -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)
Expand All @@ -94,4 +90,4 @@ bool CLuaPathDefs::isDirectory(lua_State* luaVM, std::string path)
return false;

return SharedUtil::DirectoryExists(strAbsPath);
}
}
2 changes: 1 addition & 1 deletion Shared/mods/deathmatch/logic/luadefs/CLuaPathDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma once
#include "luadefs/CLuaDefs.h"

class CLuaFileDefs : public CLuaDefs
class CLuaPathDefs : public CLuaDefs
{
public:
static void LoadFunctions();
Expand Down

0 comments on commit b2571d6

Please sign in to comment.