GetPlatform.

This commit is contained in:
jussi
2024-05-20 17:56:28 +03:00
parent 9edaf7a47b
commit c95c797da6
6 changed files with 41 additions and 0 deletions

8
API.md
View File

@@ -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
---

View File

@@ -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

View File

@@ -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

View File

@@ -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 );

View File

@@ -1490,6 +1490,31 @@ int lcoreSetGCUnload( lua_State* L ) {
return 0;
}
/*
> 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
*/

View File

@@ -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 );