summaryrefslogtreecommitdiff
path: root/src/rmath.c
diff options
context:
space:
mode:
authorjussi2024-05-01 15:21:28 +0300
committerjussi2024-05-01 15:21:28 +0300
commit4452bccfa63cf86c134aa616ee0bebcc66beca03 (patch)
treea40befeb0393fd5599240ccb85a4500781d78c17 /src/rmath.c
parentbdd660be01f3742befe15dff26929a77eeefe61d (diff)
downloadreilua-enhanced-4452bccfa63cf86c134aa616ee0bebcc66beca03.tar.gz
reilua-enhanced-4452bccfa63cf86c134aa616ee0bebcc66beca03.tar.bz2
reilua-enhanced-4452bccfa63cf86c134aa616ee0bebcc66beca03.zip
Bitwise operations for cross Lua compatibility.
Diffstat (limited to 'src/rmath.c')
-rw-r--r--src/rmath.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rmath.c b/src/rmath.c
index 7617d45..7287d66 100644
--- a/src/rmath.c
+++ b/src/rmath.c
@@ -31,6 +31,21 @@ int lmathRound( lua_State* L ) {
}
/*
+> 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 )
Clamp float value