LuaJIT compatibility.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
-- For luaJit compatibility.
|
||||
if table.unpack == nil then
|
||||
table.unpack = unpack
|
||||
end
|
||||
|
||||
Vector2 = {}
|
||||
Vector2.meta = {
|
||||
__index = Vector2,
|
||||
@@ -25,9 +30,6 @@ Vector2.meta = {
|
||||
__unm = function( v )
|
||||
return Vector2:new( -v.x, -v.y )
|
||||
end,
|
||||
__idiv = function( v, value )
|
||||
return Vector2:new( v.x // value, v.y // value )
|
||||
end,
|
||||
__len = function( v )
|
||||
local len = 0
|
||||
|
||||
@@ -90,6 +92,14 @@ function Vector2:max( v2 )
|
||||
return Vector2:new( math.max( self.x, v2.x ), math.max( self.y, v2.y ) )
|
||||
end
|
||||
|
||||
function Vector2:floor()
|
||||
return Vector2:new( math.floor( self.x ), math.floor( self.y ) )
|
||||
end
|
||||
|
||||
function Vector2:ceil()
|
||||
return Vector2:new( math.ceil( self.x ), math.ceil( self.y ) )
|
||||
end
|
||||
|
||||
function Vector2:addValue( value )
|
||||
return Vector2:new( RL.Vector2AddValue( self, value ) )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user