There is a UserInputService:GetPlatform()
, but it is RobloxScriptSecurity, they are planning to change the permission of this to None when they better have an idea of how to secure it, because there used to be a property that you could read on Player called Player::OsPlatform
, you cannot read or write to it now.
static Reflection::BoundFuncDesc<UserInputService, UserInputService::Platform(void)> func_getPlatform(&UserInputService::getPlatformLua, "GetPlatform", Security::RobloxScript);
template<>
EnumDesc<UserInputService::Platform>::EnumDesc()
:EnumDescriptor("Platform")
{
addPair(UserInputService::PLATFORM_WINDOWS, "Windows");
addPair(UserInputService::PLATFORM_OSX, "OSX");
addPair(UserInputService::PLATFORM_IOS, "IOS");
addPair(UserInputService::PLATFORM_ANDROID, "Android");
addPair(UserInputService::PLATFORM_XBOXONE, "XBoxOne");
addPair(UserInputService::PLATFORM_PS4, "PS4");
addPair(UserInputService::PLATFORM_PS3, "PS3");
addPair(UserInputService::PLATFORM_XBOX360, "XBox360");
addPair(UserInputService::PLATFORM_WIIU, "WiiU");
addPair(UserInputService::PLATFORM_NX, "NX");
addPair(UserInputService::PLATFORM_OUYA, "Ouya");
addPair(UserInputService::PLATFORM_ANDROIDTV, "AndroidTV");
addPair(UserInputService::PLATFORM_CHROMECAST, "Chromecast");
addPair(UserInputService::PLATFORM_LINUX, "Linux");
addPair(UserInputService::PLATFORM_STEAMOS, "SteamOS");
addPair(UserInputService::PLATFORM_WEBOS, "WebOS");
addPair(UserInputService::PLATFORM_DOS, "DOS");
addPair(UserInputService::PLATFORM_BEOS, "BeOS");
addPair(UserInputService::PLATFORM_UWP, "UWP");
addPair(UserInputService::PLATFORM_NONE, "None");
}
typedef enum
{
PLATFORM_WINDOWS = 0,
PLATFORM_OSX,
PLATFORM_IOS,
PLATFORM_ANDROID,
PLATFORM_XBOXONE,
PLATFORM_PS4,
PLATFORM_PS3,
PLATFORM_XBOX360,
PLATFORM_WIIU,
PLATFORM_NX,
PLATFORM_OUYA,
PLATFORM_ANDROIDTV,
PLATFORM_CHROMECAST,
PLATFORM_LINUX,
PLATFORM_STEAMOS,
PLATFORM_WEBOS,
PLATFORM_DOS,
PLATFORM_BEOS,
PLATFORM_UWP,
PLATFORM_NONE
} Platform;
// Durango is a C++ SDK for Xbox
UserInputService::Platform UserInputService::getPlatform()
{
#if defined(RBX_PLATFORM_IOS)
return PLATFORM_IOS;
#elif defined(__APPLE__) && !defined(RBX_PLATFORM_IOS)
return PLATFORM_OSX;
#elif defined(RBX_PLATFORM_DURANGO)
return PLATFORM_XBOXONE;
#elif defined(RBX_PLATFORM_UWP)
return PLATFORM_UWP;
#elif defined(RBX_PLATFORM_DURANGO)
return PLATFORM_XBOXONE;
#elif defined(_WIN32) && !defined(RBX_PLATFORM_DURANGO) && !defined(RBX_PLATFORM_UWP)
return PLATFORM_WINDOWS;
#elif defined(__ANDROID__)
return PLATFORM_ANDROID;
#else
return PLATFORM_NONE;
#endif
}