summaryrefslogtreecommitdiff
path: root/examples/resources/lib/quaternion.lua
diff options
context:
space:
mode:
authorjussi2024-05-01 15:21:28 +0300
committerjussi2024-05-01 15:21:28 +0300
commit4452bccfa63cf86c134aa616ee0bebcc66beca03 (patch)
treea40befeb0393fd5599240ccb85a4500781d78c17 /examples/resources/lib/quaternion.lua
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 'examples/resources/lib/quaternion.lua')
-rw-r--r--examples/resources/lib/quaternion.lua15
1 files changed, 3 insertions, 12 deletions
diff --git a/examples/resources/lib/quaternion.lua b/examples/resources/lib/quaternion.lua
index 47d6ee1..db700d8 100644
--- a/examples/resources/lib/quaternion.lua
+++ b/examples/resources/lib/quaternion.lua
@@ -183,11 +183,8 @@ end
function Quaternion:temp( x, y, z, w )
local object = tempPool[ curTemp ]
- curTemp = curTemp + 1
- if TEMP_COUNT < curTemp then
- curTemp = 1
- end
+ curTemp = curTemp < TEMP_COUNT and curTemp + 1 or 1
object.x = x or 0
object.y = y or 0
@@ -199,11 +196,8 @@ end
function Quaternion:tempT( t )
local object = tempPool[ curTemp ]
- curTemp = curTemp + 1
- if TEMP_COUNT < curTemp then
- curTemp = 1
- end
+ curTemp = curTemp < TEMP_COUNT and curTemp + 1 or 1
object.x, object.y, object.z, object.w = table.unpack( t )
@@ -212,11 +206,8 @@ end
function Quaternion:tempQ( q )
local object = tempPool[ curTemp ]
- curTemp = curTemp + 1
- if TEMP_COUNT < curTemp then
- curTemp = 1
- end
+ curTemp = curTemp < TEMP_COUNT and curTemp + 1 or 1
object.x = q.x
object.y = q.y