summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2024-05-20 17:56:28 +0300
committerjussi2024-05-20 17:56:28 +0300
commitc95c797da61b4b2829d542f6d7c164a88951cad4 (patch)
tree1af6e709ccbb2c15d7799be70ad42b2ab311a734
parent9edaf7a47b02bd351c400f0c6aec517884449551 (diff)
downloadreilua-enhanced-c95c797da61b4b2829d542f6d7c164a88951cad4.tar.gz
reilua-enhanced-c95c797da61b4b2829d542f6d7c164a88951cad4.tar.bz2
reilua-enhanced-c95c797da61b4b2829d542f6d7c164a88951cad4.zip
GetPlatform.
-rw-r--r--API.md8
-rw-r--r--ReiLua_API.lua5
-rw-r--r--changelog1
-rw-r--r--include/core.h1
-rw-r--r--src/core.c25
-rw-r--r--src/lua_core.c1
6 files changed, 41 insertions, 0 deletions
diff --git a/API.md b/API.md
index c7f17d8..5f740c5 100644
--- a/API.md
+++ b/API.md
@@ -4496,6 +4496,14 @@ Set Lua garbage collection to unload object data
---
+> platform = RL.GetPlatform()
+
+Get platform. Returns "Windows", "Linux", "FreeBSD", "OpenBSD", "Apple" or "Emscripten"
+
+- Success return string
+
+---
+
## Core - Files management functions
---
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index 35b0778..7e0b28e 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -1882,6 +1882,11 @@ function RL.IsGCUnloadEnabled() end
---@return any RL.SetGCUnload
function RL.SetGCUnload( enabled ) end
+---Get platform. Returns "Windows", "Linux", "FreeBSD", "OpenBSD", "Apple" or "Emscripten"
+---- Success return string
+---@return any platform
+function RL.GetPlatform() end
+
-- Core - Files management functions
---Load file data as byte array (read). Buffer type is BUFFER_UNSIGNED_CHAR
diff --git a/changelog b/changelog
index db8008e..966316c 100644
--- a/changelog
+++ b/changelog
@@ -49,6 +49,7 @@ DETAILED CHANGES:
- ADDED: Bitwise operations for cross Lua compatibility.
- ADDED: GetMeshData.
- FIXED: GenMeshCustom indices wasn't changing triangleCount.
+ - ADDED: GetPlatform.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
diff --git a/include/core.h b/include/core.h
index 11a8d2a..d72fdb9 100644
--- a/include/core.h
+++ b/include/core.h
@@ -114,6 +114,7 @@ int lcoreGetLogLevelInvalid( lua_State* L );
int lcoreOpenURL( lua_State* L );
int lcoreIsGCUnloadEnabled( lua_State* L );
int lcoreSetGCUnload( lua_State* L );
+int lcoreGetPlatform( lua_State* L );
/* Files management functions. */
int lcoreLoadFileData( lua_State* L );
int lcoreSaveFileData( lua_State* L );
diff --git a/src/core.c b/src/core.c
index 2146510..d22ed60 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1491,6 +1491,31 @@ int lcoreSetGCUnload( lua_State* L ) {
}
/*
+> platform = RL.GetPlatform()
+
+Get platform. Returns "Windows", "Linux", "FreeBSD", "OpenBSD", "Apple" or "Emscripten"
+
+- Success return string
+*/
+int lcoreGetPlatform( lua_State* L ) {
+#if defined( _WIN32 )
+ lua_pushstring( L, "Windows" );
+#elif defined( __linux__ )
+ lua_pushstring( L, "Linux" );
+#elif defined( __FreeBSD__ )
+ lua_pushstring( L, "FreeBSD" );
+#elif defined( __OpenBSD__ )
+ lua_pushstring( L, "OpenBSD" );
+#elif defined( __APPLE__ )
+ lua_pushstring( L, "Apple" );
+#elif defined( __EMSCRIPTEN__ )
+ lua_pushstring( L, "Emscripten" );
+#endif
+
+ return 1;
+}
+
+/*
## Core - Files management functions
*/
diff --git a/src/lua_core.c b/src/lua_core.c
index 6d89777..6330930 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -1378,6 +1378,7 @@ void luaRegister() {
assingGlobalFunction( "OpenURL", lcoreOpenURL );
assingGlobalFunction( "IsGCUnloadEnabled", lcoreIsGCUnloadEnabled );
assingGlobalFunction( "SetGCUnload", lcoreSetGCUnload );
+ assingGlobalFunction( "GetPlatform", lcoreGetPlatform );
/* Files management functions. */
assingGlobalFunction( "LoadFileData", lcoreLoadFileData );
assingGlobalFunction( "SaveFileData", lcoreSaveFileData );