Browse Source

Add love._os, which contains a string representing the current OS (or, at least, the OS the copy of LÖVE was compiled on).

Bill Meltsner 13 years ago
parent
commit
322ec7bba4
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/love.cpp

+ 11 - 0
src/love.cpp

@@ -124,6 +124,17 @@ extern "C" LOVE_EXPORT int luaopen_love(lua_State * L)
 	}
 	}
 
 
 	lua_setfield(L, -2, "_version_compat");
 	lua_setfield(L, -2, "_version_compat");
+	
+#ifdef LOVE_WINDOWS
+	lua_pushstring(L, "Windows");
+#elif defined(LOVE_MACOSX)
+	lua_pushstring(L, "OS X");
+#elif defined(LOVE_LINUX)
+	lua_pushstring(L, "Linux");
+#else
+	lua_pushstring(L, "Unknown");
+#endif
+	lua_setfield(L, -2, "_os");
 
 
 #ifdef LOVE_BUILD_STANDALONE
 #ifdef LOVE_BUILD_STANDALONE