LSL Operators

Operators are used to cause an operation (or mathematical action) to be performed on one (such as !) or two operands. The easy and common example is 1 + 2 where 1 and 2 are operands, and the + is the operator. This concept can be extended much further with LSL since operands can be variables with the special case of the assignment operators requiring that the left hand side be a variable.

The following table lists the operators in descending order of evaluation, i.e. higher in the table means higher evaluation precedence. Multiple operators on the same line share evaluation precedence. Parenthesize an expression if you need to force an evaluation order.

Operator Description Usage Example
() parentheses: grouping and evaluation precedence integer val = a * (b + c);
[] brackets: list constructor list lst = [a, 2, “this”, 0.01];
(type) typecasting string message = “The result is:” + (string)result;
QR Code
QR Code wiki:scripting_portal:lsl_operators (generated for current page)