summaryrefslogtreecommitdiff
path: root/examples/resources/lib/vector3.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/resources/lib/vector3.lua')
-rw-r--r--examples/resources/lib/vector3.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/resources/lib/vector3.lua b/examples/resources/lib/vector3.lua
index bfecb07..7b339f6 100644
--- a/examples/resources/lib/vector3.lua
+++ b/examples/resources/lib/vector3.lua
@@ -3,8 +3,6 @@ if table.unpack == nil then
table.unpack = unpack
end
-local Vector2 = Vector2 or require( "vector2" )
-
local Vector3 = {}
local metatable = {
__index = Vector3,
@@ -38,6 +36,12 @@ local metatable = {
__eq = function( v1, v2 )
return RL.Vector3Equals( v1, v2 )
end,
+ __lt = function( v1, v2 )
+ return v1.x < v2.x and v1.y < v2.y and v1.z < v2.z
+ end,
+ __le = function( v1, v2 )
+ return v1.x <= v2.x and v1.y <= v2.y and v1.z <= v2.z
+ end,
__concat = function( a, b )
return tostring( a )..tostring( b )
end,
@@ -232,6 +236,10 @@ function Vector3:equals( v2 )
return RL.Vector3Equals( self, v2 )
end
+function Vector3:sign()
+ return Vector3:new( RL.Sign( self.x ), RL.Sign( self.y ), RL.Sign( self.z ) )
+end
+
function Vector3:addEq( v2 )
self.x = self.x + v2.x
self.y = self.y + v2.y