Difference between revisions of "Category:LSL Operators"

From Second Life Wiki
Jump to navigation Jump to search
m (rough draft start)
m (tweaked)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}}
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}}{{RightToc}}
Page recreated to house the future revision of the LSL_Operators page into categorized Content. '''Please do not delete.'''
Page recreated to house the future revision of the LSL_Operators page into categorized Content. '''Please do not delete.'''


if you're looking for the current version, it may be found at [[LSL_Operators]].
if you're looking for the current version, it may be found at [[LSL_Operators]].


== Operator Precedence ==
{{void-box
current rough draft of precedence
|title=Operator Precedence (Order of Operations)
{| bgcolor="#FFFFFF" border="1"  cellspacing="2" cellpadding="6"
|content=
|- bgColor="#A7C1F2"
{{{!}} bgcolor="#FFFFFF" border="1"  cellspacing="2" cellpadding="6"
{{!}}- bgColor="#A7C1F2"
! Operator
! Operator
! Notes
! Description
|-
! Direction
| ()
{{!}}- bgColor="#E0E0E0"
|| Parenthesis:
{{!}} ,
all operation within have higher precedence than those outside
{{!}}{{!}} Separator
|-
{{!}}{{!}} Left to Right{{Footnote|handle=1|Separators promote ALL operators to the left until the first unmatched, from its position, open-bracket or open-parenthesis. This precedence ONLY applies within the brackets/parenthesis containing it}}
| (list)<br>(integer)<br>(float)<br>(vector)<br>(rotation)<br>(string)<br>(key)<br>++(prefix)<br>--(prefix)<br>~<br>-<br>!
{{!}}-
|| Prefix Operators:
{{!}}
When combined together, order of execution takes precedence (- is negation in this context not subtraction)
++<br>
|-
--<br>
| /<br>%<br>*<br>&<br><nowiki>|</nowiki><br>^
.<br>
|| Division, Multiplication, and Bitwise operators:
&nbsp;
|-
{{!}}{{!}}
| +<br>-
Increment<br>
|| Addition and Subtraction Operators:
Decrement<br>
(- is subtraction in this context not negation)
Element Selector<br>
|-
(also Variable Evaluation)
| &&<br><nowiki>||</nowiki><br>==<br>!=<br><=<br>>=<br>><br><
{{!}}{{!}} Right to Left
|| Logical Operators
{{!}}-  bgColor="#E0E0E0"
order of execution takes precedence when multiple operators of this type are in the same operation
{{!}}
|-
=<br>
| =<br>+=<br>-=<br>/=<br>%=<br>*=
+=<br>
|| Assignment Operators:
-=<br>
|-
/=<br>
| (postfix)++<br>(postfix)--
%=<br>
|| Postfix Operators:
<nowiki>*=</nowiki>
|-}
{{!}}{{!}}
Direct Assignment<br>
Addition/Concatenation Assignment<br>
Subtraction Assignment<br>
Division Assignment<br>
Modulo/Cross-Product Assignment<br>
Multiplication/Dot-Product Assignment
{{!}}{{!}}
Right to Left{{Footnote|handle=2|Assignment operators promote ALL operators to the right, from its position, until the first un-bracketed/parenthesized separator, unmatched close bracket or close parenthesis, or semicolon. This precedence ONLY applies within the brackets/parenthesis containing it}}
{{!}}-
{{!}}
()<br>
[]
{{!}}{{!}}
Parenthesis<br>
[[List|List Constructor]]
{{!}}{{!}} Inner to Outer
{{!}}-
{{!}}
(type)<br>
~<br>
<nowiki>!</nowiki><br>
-
{{!}}{{!}}
[[Typecast]]<br>
Bitwise NOT<br>
Logical NOT<br>
Negation
{{!}}{{!}} Right to Left
{{!}}-
{{!}}
/<br>
%<br>
<nowiki>*</nowiki>
{{!}}{{!}}
Division<br>
Modulus<br>
Multiplication
{{!}}{{!}} Left to Right
{{!}}-
{{!}}
-<br>
+
{{!}}{{!}}
Subtraction<br>
[[LSL_Addition|Addition/Concatenation]]
{{!}}{{!}} Left to Right
{{!}}-
{{!}}
<<<br>
>>
{{!}}{{!}}
Bitwise Shift Left<br>
Bitwise Shift Right
{{!}}{{!}} Left to Right
{{!}}-
{{!}}
<<br>
><br>
<=<br>
>=
{{!}}{{!}}
Less Than<br>
Greater Than<br>
Less Than or Equal<br>
Greater Than or Equal
{{!}}{{!}} Left to Right
{{!}}-
{{!}}
==<br>
<nowiki>!=</nowiki>
{{!}}{{!}}
Equivalent<br>
NOT Equivalent
{{!}}{{!}} Left to Right
{{!}}-
{{!}} &
{{!}}{{!}} Bitwise AND
{{!}}{{!}} Left to Right
{{!}}-
{{!}} ^
{{!}}{{!}} Bitwise eXclusive OR
{{!}}{{!}} Left to Right
{{!}}-
{{!}} <nowiki>|</nowiki>
{{!}}{{!}} Bitwise OR
{{!}}{{!}} Left to Right
{{!}}-
{{!}}
&&<br>
<nowiki>||</nowiki>
{{!}}{{!}}
Logical AND<br>
Logical OR
{{!}}{{!}} Left to Right{{Footnote|handle=3|There is no Short Circuiting of Logical Operators in LSL, both operands will be evaluated regardless.}}
{{!}}}
=== Special Notes ===
{{Footnotes}}
}}


== Order of Execution ==
{{void-box
|title= Logical Operators
|content=
Logical Operators are operators those result is either TRUE or FAlSE.
* insert truth tables
}}
 
{{void-box
|title=Bitwise Operators
|content=
Bitwise Operators are similar to Logical Operators, but act on all bits of an integer simultaneously as if they were each a Boolean value.
* flesh this out
}}

Latest revision as of 17:06, 29 September 2010

Page recreated to house the future revision of the LSL_Operators page into categorized Content. Please do not delete.

if you're looking for the current version, it may be found at LSL_Operators.

Operator Precedence (Order of Operations)

Operator Description Direction
, Separator Left to Right[1]

++
--
.
 

Increment
Decrement
Element Selector
(also Variable Evaluation)

Right to Left

=
+=
-=
/=
%=
*=

Direct Assignment
Addition/Concatenation Assignment
Subtraction Assignment
Division Assignment
Modulo/Cross-Product Assignment
Multiplication/Dot-Product Assignment

Right to Left[2]

()
[]

Parenthesis
List Constructor

Inner to Outer

(type)
~
!
-

Typecast
Bitwise NOT
Logical NOT
Negation

Right to Left

/
%
*

Division
Modulus
Multiplication

Left to Right

-
+

Subtraction
Addition/Concatenation

Left to Right

<<
>>

Bitwise Shift Left
Bitwise Shift Right

Left to Right

<
>
<=
>=

Less Than
Greater Than
Less Than or Equal
Greater Than or Equal

Left to Right

==
!=

Equivalent
NOT Equivalent

Left to Right
& Bitwise AND Left to Right
^ Bitwise eXclusive OR Left to Right
| Bitwise OR Left to Right

&&
||

Logical AND
Logical OR

Left to Right[3]

Special Notes

  1. ^ Separators promote ALL operators to the left until the first unmatched, from its position, open-bracket or open-parenthesis. This precedence ONLY applies within the brackets/parenthesis containing it
  2. ^ Assignment operators promote ALL operators to the right, from its position, until the first un-bracketed/parenthesized separator, unmatched close bracket or close parenthesis, or semicolon. This precedence ONLY applies within the brackets/parenthesis containing it
  3. ^ There is no Short Circuiting of Logical Operators in LSL, both operands will be evaluated regardless.

Logical Operators

Logical Operators are operators those result is either TRUE or FAlSE.

  • insert truth tables

Bitwise Operators

Bitwise Operators are similar to Logical Operators, but act on all bits of an integer simultaneously as if they were each a Boolean value.

  • flesh this out

Pages in category "LSL Operators"

This category contains only the following page.