LSL Addition

From Second Life Wiki
Revision as of 14:50, 24 January 2010 by Strife Onizuka (talk | contribs)
Jump to navigation Jump to search

Integer

  • Operation: Addition
    • Example:
      • 1 + 1
      • Result = 2
  • See Note1

Float

  • Operation: Addition
    • Example:
      • 1.5 + 1.5
      • Result = 3.0
  • 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>

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

  1. When one operand is an Integer, and the other is a Float, the Integer is first typecast to Float before addition.
  2. This operator is rarely used with this type as it is not a meaningful way of combining quaternions being used to represent rotations.
  3. 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.
    • I'll write one when I have some time -- Strife (talk|contribs) 22:49, 24 January 2010 (UTC)