From 4452bccfa63cf86c134aa616ee0bebcc66beca03 Mon Sep 17 00:00:00 2001 From: jussi Date: Wed, 1 May 2024 15:21:28 +0300 Subject: Bitwise operations for cross Lua compatibility. --- src/rmath.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/rmath.c') diff --git a/src/rmath.c b/src/rmath.c index 7617d45..7287d66 100644 --- a/src/rmath.c +++ b/src/rmath.c @@ -30,6 +30,21 @@ int lmathRound( lua_State* L ) { return 1; } +/* +> result = RL.Sign( float value ) + +Sign of value + +- Success return int +*/ +int lmathSign( lua_State* L ) { + float value = luaL_checknumber( L, 1 ); + + lua_pushinteger( L, 0 <= value ? 1 : -1 ); + + return 1; +} + /* > result = RL.Clamp( float value, float min, float max ) -- cgit v1.2.3