Object lib serialization.
This commit is contained in:
@@ -67,7 +67,6 @@ function Vector2:newV( v )
|
||||
return object
|
||||
end
|
||||
|
||||
|
||||
function Vector2:set( x, y )
|
||||
self.x = x or 0
|
||||
self.y = y or self.x
|
||||
@@ -82,6 +81,10 @@ function Vector2:setV( v )
|
||||
self.y = v.y
|
||||
end
|
||||
|
||||
function Vector2:serialize()
|
||||
return "Vector2:new("..self.x..","..self.y..")"
|
||||
end
|
||||
|
||||
function Vector2:arr()
|
||||
return { self.x, self.y }
|
||||
end
|
||||
@@ -106,6 +109,10 @@ function Vector2:max( v2 )
|
||||
return Vector2:new( math.max( self.x, v2.x ), math.max( self.y, v2.y ) )
|
||||
end
|
||||
|
||||
function Vector2:round()
|
||||
return Vector2:new( RL.Round( self.x ), RL.Round( self.y ) )
|
||||
end
|
||||
|
||||
function Vector2:floor()
|
||||
return Vector2:new( math.floor( self.x ), math.floor( self.y ) )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user