Add Operator

From GMod Wiki

Revision as of 20:42, 18 November 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

__add is a type of overloaded operator. You might have noticed that some objects have a function called __add. Well, you don't run __add like this - You run __add by typing the name of the object, a plus sign (+) and the name of another object.

Example

For example, you can add vectors:

DescriptionAdds two vectors
Used onNewerShared.png
Code
 
myVector=Vector(1,1,1)+Vector(2,2,2)
 
OutputmyVector becomes vector equal to Vector(3,3,3)
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox