summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2023-11-13 23:42:58 +0200
committerjussi2023-11-13 23:42:58 +0200
commit7b10306ed5c87517800a6058ad84e27c866f81c6 (patch)
tree68b58fed65ed81362a80b34974bfaa8c4345e5c8 /src
parente06d98e0ed820c64df99c451e2c24a481d7349e8 (diff)
downloadreilua-enhanced-7b10306ed5c87517800a6058ad84e27c866f81c6.tar.gz
reilua-enhanced-7b10306ed5c87517800a6058ad84e27c866f81c6.tar.bz2
reilua-enhanced-7b10306ed5c87517800a6058ad84e27c866f81c6.zip
Matrix library.
Diffstat (limited to 'src')
-rw-r--r--src/lua_core.c13
-rw-r--r--src/rmath.c4
2 files changed, 15 insertions, 2 deletions
diff --git a/src/lua_core.c b/src/lua_core.c
index 843a38a..0eca9be 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -2693,6 +2693,19 @@ Matrix uluaGetMatrix( lua_State *L, int index ) {
if ( lua_isnumber( L, -1 ) ) {
m[i][j] = lua_tonumber( L, -1 );
}
+ /* Look for one depth further if Matrix given as class. */
+ else if ( lua_istable( L, -1 ) ) {
+ int t3 = lua_gettop( L ), k = 0;
+ lua_pushnil( L );
+
+ while ( lua_next( L, t3 ) != 0 ) {
+ if ( lua_isnumber( L, -1 ) ) {
+ m[j][k] = lua_tonumber( L, -1 );
+ }
+ k++;
+ lua_pop( L, 1 );
+ }
+ }
j++;
lua_pop( L, 1 );
}
diff --git a/src/rmath.c b/src/rmath.c
index 529a347..8dd9905 100644
--- a/src/rmath.c
+++ b/src/rmath.c
@@ -1308,7 +1308,7 @@ int lmathMatrixRotateZ( lua_State *L ) {
}
/*
-> result = RL.MatrixRotateXYZ( Vector3 angle )
+> result = RL.MatrixRotateXYZ( Vector3 angles )
Get xyz-rotation matrix (angles in radians)
@@ -1323,7 +1323,7 @@ int lmathMatrixRotateXYZ( lua_State *L ) {
}
/*
-> result = RL.MatrixRotateZYX( Vector3 angle )
+> result = RL.MatrixRotateZYX( Vector3 angles )
Get zyx-rotation matrix (angles in radians)