From ebe3630ec8bfefe7b77df8f1570ed4387f2f3641 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 16 Sep 2021 12:22:49 +0200 Subject: [PATCH] LuaAPI: Implement GetOSName --- include/LuaAPI.h | 2 +- src/LuaAPI.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/LuaAPI.h b/include/LuaAPI.h index b7b6493..93ea0ac 100644 --- a/include/LuaAPI.h +++ b/include/LuaAPI.h @@ -8,7 +8,7 @@ void Print(sol::variadic_args); namespace MP { static inline TLuaEngine* Engine { nullptr }; - void GetOSName(); + std::string GetOSName(); std::tuple GetServerVersion(); } } diff --git a/src/LuaAPI.cpp b/src/LuaAPI.cpp index 084df24..03a7bdc 100644 --- a/src/LuaAPI.cpp +++ b/src/LuaAPI.cpp @@ -32,7 +32,14 @@ static std::string LuaToString(const sol::object& Value) { } } -void LuaAPI::MP::GetOSName() { +std::string LuaAPI::MP::GetOSName() { +#if WIN32 + return "Windows"; +#elif __linux + return "Linux"; +#else + return "Other"; +#endif } std::tuple LuaAPI::MP::GetServerVersion() {