From f429711dd5d4c675ba9fe9e8f76610bc81bf3f07 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Thu, 13 May 2010 12:01:44 -0500 Subject: [PATCH] Add GetOSName() binding. Returns a string representing the current OS (untested on everything but Windows, should work for everything but BSD, for which I forget the switch off the top of my head) --- src/LuaManager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/LuaManager.cpp b/src/LuaManager.cpp index 06818c591a..ef9cfb5751 100644 --- a/src/LuaManager.cpp +++ b/src/LuaManager.cpp @@ -968,6 +968,24 @@ extern const char *const version_time; LuaFunction( VersionDate, (RString) version_date ); LuaFunction( VersionTime, (RString) version_time ); +static RString GetOSName() +{ + RString system; + #if defined(XBOX) + system = "Xbox"; + #elif defined(WIN32) && !defined(XBOX) + system = "Windows"; + #elif defined(LINUX) + system = "Linux"; + #elif defined(DARWIN) + system = "Mac"; + #else + system = "Unknown"; + #endif + return system; +} +LuaFunction( GetOSName, GetOSName() ); + static float scale( float x, float l1, float h1, float l2, float h2 ) { return SCALE( x, l1, h1, l2, h2 );