Skip to content

Commit

Permalink
Merge pull request GmodStarfall#72 from awilliamson/I36
Browse files Browse the repository at this point in the history
VMatrix SF.CheckType Fix & __mul metamethod fix.
  • Loading branch information
Xandaros committed Mar 10, 2014
2 parents 54a5e0a + 9ce39b7 commit b1fa044
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lua/starfall/libs_sh/vmatrix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@ SF.DefaultEnvironment.Matrix = function()
end

function vmatrix_methods:getAngles()
SF.CheckType( self, vmatrix_metamethods )
return unwrap(self):GetAngles()
end

function vmatrix_methods:getScale()
SF.CheckType( self, vmatrix_metamethods )
return unwrap(self):GetScale()
end

function vmatrix_methods:getTranslation()
SF.CheckType( self, vmatrix_metamethods )
return unwrap(self):GetTranslation()
end

function vmatrix_methods:rotate( ang )
SF.CheckType( self, vmatrix_metamethods )
SF.CheckType( ang, "Angle")

local v = unwrap(self)
Expand All @@ -38,48 +34,42 @@ function vmatrix_methods:rotate( ang )
end

function vmatrix_methods:scale( vec )
SF.CheckType( self, vmatrix_metamethods )
SF.CheckType( vec, "Vector" )

local v = unwrap(self)
v:Scale( vec )
end

function vmatrix_methods:scaleTranslation( num )
SF.CheckType( self, vmatrix_metamethods )
SF.CheckType( num, "Number" )

local v = unwrap(self)
v:ScaleTranslation( num )
end

function vmatrix_methods:setAngles( ang )
SF.CheckType( self, vmatrix_metamethods )
SF.CheckType( ang, "Angle" )

local v = unwrap(self)
v:SetAngles( ang )
end

function vmatrix_methods:setTranslation( vec )
SF.CheckType( self, vmatrix_metamethods )
SF.CheckType( vec, "Vector" )

local v = unwrap(self)
v:SetTranslation( vec )
end

function vmatrix_methods:translate( vec )
SF.CheckType( self, vmatrix_metamethods )
SF.CheckType( vec, "Vector" )

local v = unwrap(self)
v:Translate( vec )
end

function vmatrix_metamethods.__mul( lhs, rhs )
SF.CheckType( lhs, vmatrix_metamethods )
SF.CheckType( rhs, vmatrix_metamethods )

return wrap(unwrap(rhs) * unwrap(rhs))
return wrap(unwrap(lhs) * unwrap(rhs))
end

0 comments on commit b1fa044

Please sign in to comment.