Difference between revisions of "LSL Addition"
Jump to navigation
Jump to search
m |
Void Singer (talk | contribs) m (tweaked) |
||
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> | <div style="float:right;">__TOC__</div> | ||
<!-- 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 --> | |||
{{void-box | {{void-box | ||
|title=[[:Category:LSL Operators|Operator]]<nowiki>:</nowiki> ''+'' | |title=[[:Category:LSL Operators|Operator]]<nowiki>:</nowiki> ''+'' | ||
Line 21: | Line 21: | ||
*** 1 + 1 | *** 1 + 1 | ||
*** Result = 2 | *** Result = 2 | ||
Note: If one variable or value is a float, the integer value will be cast to a float automatically. | |||
}} | }} | ||
Line 31: | Line 31: | ||
*** 1.5 + 1.5 | *** 1.5 + 1.5 | ||
*** Result = 3.0 | *** Result = 3.0 | ||
Note: If one variable or value is an integer, the integer value will be cast to a float automatically. | |||
}} | }} | ||
Line 38: | Line 38: | ||
|content= | |content= | ||
* Operation: Addition | * Operation: Addition | ||
** | ** Examples: | ||
*** <1.0, 1.0, 1.0> + <1.0, 0.0, -1.0> | *** <1.0, 1.0, 1.0> + <1.0, 0.0, -1.0> | ||
*** Result = <2.0, 1.0, 0.0> | *** Result = <2.0, 1.0, 0.0> | ||
*** Action: <a.x, a.y, a.z> + <nowiki><b.x, b.y, b.z></nowiki> == <a.x + b.x, a.y + b.y, a.z + b.z> | |||
*** <-1.0, 0.0, 1.0> + 1.0 | |||
*** Result: <0.0, 1.0, 2.0> | |||
*** Action: <a.x, a.y, a.z> + b == <a.x + b, a.y + b, a.z + b> | |||
Note: All elements are floats, if any are written as integers they will be cast to floats automatically | |||
}} | }} | ||
Line 48: | Line 52: | ||
|content= | |content= | ||
* Operation: unknown! | * Operation: unknown! | ||
Note: 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. Use Multiplication instead. | |||
<!-- example ommited because it's rather useless... I don't know why LL allowed this as a valid type, does anyone else? --> | <!-- example ommited because it's rather useless... I don't know why LL allowed this as a valid type, does anyone else? --> | ||
}} | }} | ||
Line 57: | Line 61: | ||
* Operation: Concatenation (adds to the end of) | * Operation: Concatenation (adds to the end of) | ||
** Example: | ** Example: | ||
** "abc" + "def" | *** "abc" + "def" | ||
** Result = "abcdef" | *** Result = "abcdef" | ||
Note: While [[Key]]s are a specialized type of [[String]] They cannot be directly used with this operator. | |||
}} | }} | ||
Line 68: | Line 72: | ||
** Example: | ** Example: | ||
** [0, 0.0, <0.0, 0.0, 0.0>, ""] + [1, 1.0, <1.0, 1.0, 1.0>, "xyz"] | ** [0, 0.0, <0.0, 0.0, 0.0>, ""] + [1, 1.0, <1.0, 1.0, 1.0>, "xyz"] | ||
*** Result | *** Result: [0, 0.0, <0.0, 0.0, 0.0>, "", 1, 1.0, <1.0, 1.0, 1.0>, "xyz"] | ||
*** list + value = [contents_of_list, value] | |||
Note: If the type of the variable or value being added to a list is not a list it will be cast to a list automatically | |||
<!-- Needs to be more explicit about mixing types. --> | <!-- 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. --> | <!-- concatenation doesn't affect the types stored so it shouldn't be an issue for this page... assignment shorthands might need it. --> | ||
Line 76: | Line 82: | ||
|title=Notes | |title=Notes | ||
|content= | |content= | ||
* needs link for article about min/max integer/float values | * needs link for article about min/max integer/float values | ||
* needs link for article about max string and list lengths | * needs link for article about max string and list lengths |
Revision as of 00:03, 30 September 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Integer
- Operation: Addition
- Example:
- 1 + 1
- Result = 2
- Example:
Float
- Operation: Addition
- Example:
- 1.5 + 1.5
- Result = 3.0
- Example:
Vector
- Operation: Addition
- Examples:
- <1.0, 1.0, 1.0> + <1.0, 0.0, -1.0>
- Result = <2.0, 1.0, 0.0>
- Action: <a.x, a.y, a.z> + <b.x, b.y, b.z> == <a.x + b.x, a.y + b.y, a.z + b.z>
- <-1.0, 0.0, 1.0> + 1.0
- Result: <0.0, 1.0, 2.0>
- Action: <a.x, a.y, a.z> + b == <a.x + b, a.y + b, a.z + b>
- Examples:
Rotation
- Operation: unknown!
String
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"]
- list + value = [contents_of_list, value]
Notes
- 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