Difference between revisions of "LSL Addition"
Jump to navigation
Jump to search
Void Singer (talk | contribs) m (trying out a different layout to work better with the contents box) |
|||
Line 1: | Line 1: | ||
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} | {{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} | ||
<div style="float:right;">__TOC__</div> | |||
{{void-box | {{void-box | ||
|title=[[:Category:LSL Operators|Operator]]<nowiki>:</nowiki> ''+'' | |title=[[:Category:LSL Operators|Operator]]<nowiki>:</nowiki> ''+'' | ||
|content= | |content= | ||
=== | === Valid Types: === | ||
* [[Integer]]: Addition | * [[#Integer|Integer]] | ||
* [[#Vector|Vector]] | |||
* [[#Rotation|Rotation]] | |||
* [[#String|String]] | |||
<!-- Key's don't support addition --> | |||
* [[#List|List]] | |||
}} | |||
{{void-box | |||
|title=Integer | |||
|content= | |||
* Operation: Addition | |||
** Example: | ** Example: | ||
*** | *** 1 + 1 | ||
*** Result = | *** Result = 2 | ||
* [[ | * See [[#Notes|Note<sup>1</sup>]] | ||
}} | |||
{{void-box | |||
|title=Float | |||
|content= | |||
* Operation: Addition | |||
** Example: | ** Example: | ||
*** | *** 1.5 + 1.5 | ||
*** | *** Result = 3.0 | ||
* | * See [[#Notes|Note<sup>1</sup>]] | ||
}} | |||
* | |||
{{void-box | |||
|title=Vector | |||
|content= | |||
* Operation: Addition | |||
** Example: | ** Example: | ||
*** <1.0, 1.0, 1.0> + <1.0, 0.0, -1.0> | *** <1.0, 1.0, 1.0> + <1.0, 0.0, -1.0> | ||
<!-- probably needs a more explicit a.x + b.x, a.y + b.y, a.z + b.z example --> | |||
*** Result = <2.0, 1.0, 0.0> | *** Result = <2.0, 1.0, 0.0> | ||
}} | |||
* | |||
* | {{void-box | ||
|title=Rotation | |||
|content= | |||
* Operation: unknown! | |||
* See [[#Notes|Note<sup>2</sup>]] | |||
<!-- example ommited because it's rather useless... I don't know why LL allowed this as a valid type, does anyone else? --> | |||
}} | |||
{{void-box | |||
|title=String | |||
|content= | |||
* Operation: Concatenation (adds to the end of) | |||
** Example: | ** Example: | ||
** | ** "abc" + "def" | ||
** Result = "abcdef" | |||
* See [[#Notes|Note<sup>3</sup>]] | |||
}} | |||
{{void-box | |||
|title=List | |||
* | |content= | ||
* Operation: Concatenation (adds to the end of) | |||
** Example: | ** Example: | ||
** [ | ** [0, 0.0, <0.0, 0.0, 0.0>, ""] + [1, 1.0, <1.0, 1.0, 1.0>, "xyz"] | ||
*** Result = [1, | *** Result = [0, 0.0, <0.0, 0.0, 0.0>, "", 1, 1.0, <1.0, 1.0, 1.0>, "xyz"] | ||
<!-- Needs to be more explicit about mixing types. --> | |||
<!-- concatenation doesn't affect the types stored so it shouldn't be an issue for this page... assignment shorthands might need it. --> | |||
}} | }} | ||
Line 42: | Line 76: | ||
|title=Notes | |title=Notes | ||
|content= | |content= | ||
* | # When one operand is an Integer, and the other is a Float, the Integer is first typecast to Float before addition. | ||
* link article about min/max integer/float values | # This operator is rarely used with this type as it is not a meaningful way of combining [[quaternion]]s being used to represent [[rotation]]s. | ||
* link article about max string | #* Use the [[LSL_Multiplication#Rotation|Multiplication]] operator instead. | ||
<!-- I'm worried about parsing operation pages by the actual symbols, so am preferring friendly 'common' names for the operator pages, and specifying the actual operation in the description of it's action, especially since there can be multiple operation types with one operator --> | |||
# While [[Key]]s are a specialized type of [[String]] They cannot be directly used with this operator. | |||
* needs link for article about min/max integer/float values | |||
* needs link for article about max string and list lengths | |||
* '''It'd be helpful if someone wrote a template for this page so that it might be abstracted to other operators after layout is finalized''' | |||
** this is only a sample layout, feel free to suggest other layouts. | |||
}} | }} | ||
[[Category:LSL_Operators]] | [[Category:LSL_Operators]] |
Revision as of 10:01, 16 January 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Integer
- Operation: Addition
- Example:
- 1 + 1
- Result = 2
- Example:
- See Note1
Float
- Operation: Addition
- Example:
- 1.5 + 1.5
- Result = 3.0
- Example:
- See Note1
Vector
- Operation: Addition
- Example:
- <1.0, 1.0, 1.0> + <1.0, 0.0, -1.0>
- Result = <2.0, 1.0, 0.0>
- Example:
Rotation
- Operation: unknown!
- See Note2
String
- Operation: Concatenation (adds to the end of)
- Example:
- "abc" + "def"
- Result = "abcdef"
- See Note3
List
- Operation: Concatenation (adds to the end of)
- Example:
- [0, 0.0, <0.0, 0.0, 0.0>, ""] + [1, 1.0, <1.0, 1.0, 1.0>, "xyz"]
- Result = [0, 0.0, <0.0, 0.0, 0.0>, "", 1, 1.0, <1.0, 1.0, 1.0>, "xyz"]
Notes
- When one operand is an Integer, and the other is a Float, the Integer is first typecast to Float before addition.
- This operator is rarely used with this type as it is not a meaningful way of combining quaternions being used to represent rotations.
- Use the Multiplication operator instead.
- While Keys are a specialized type of String They cannot be directly used with this operator.
- needs link for article about min/max integer/float values
- needs link for article about max string and list lengths
- It'd be helpful if someone wrote a template for this page so that it might be abstracted to other operators after layout is finalized
- this is only a sample layout, feel free to suggest other layouts.