diff options
| -rw-r--r-- | API.md | 8 | ||||
| -rw-r--r-- | ReiLua_API.lua | 5 | ||||
| -rw-r--r-- | changelog | 1 | ||||
| -rw-r--r-- | include/core.h | 1 | ||||
| -rw-r--r-- | src/core.c | 25 | ||||
| -rw-r--r-- | src/lua_core.c | 1 |
6 files changed, 41 insertions, 0 deletions
@@ -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 @@ -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 ); @@ -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 ); |
