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.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/examples/resources/lib/vector3.lua b/examples/resources/lib/vector3.lua
index c2a7b10..9e3ceb1 100644
--- a/examples/resources/lib/vector3.lua
+++ b/examples/resources/lib/vector3.lua
@@ -1,3 +1,8 @@
+-- For luaJit compatibility.
+if table.unpack == nil then
+ table.unpack = unpack
+end
+
Vector3 = {}
Vector3.meta = {
__index = Vector3,
@@ -25,9 +30,6 @@ Vector3.meta = {
__unm = function( v )
return Vector3:new( -v.x, -v.y, -v.z )
end,
- __idiv = function( v, value )
- return Vector3:new( v.x // value, v.y // value, v.z // value )
- end,
__len = function( v )
local len = 0
@@ -94,6 +96,14 @@ function Vector3:max( v2 )
return Vector3:new( RL.Vector3Max( self, v2 ) )
end
+function Vector3:floor()
+ return Vector3:new( math.floor( self.x ), math.floor( self.y ), math.floor( self.z ) )
+end
+
+function Vector3:ceil()
+ return Vector3:new( math.ceil( self.x ), math.ceil( self.y ), math.ceil( self.z ) )
+end
+
function Vector3:addValue( value )
return Vector3:new( RL.Vector3AddValue( self, value ) )
end