Constants
Constants are pre-defined
values that do not change--they're constant:
TRUE will always equal 1. However, this does not mean that values should be used instead; while there's no
technical reason not to, constants exist to simplify your
code and make it easier to understand. It's
good coding practice to use them.
This page is for general constants; function-specific ones should be documented on the
functions page.
You can find an almost complete list of constants & values on LexFile.
float
PI | 3.1415926535897932384626433832795 (pi) |
TWO_PI | 6.283185307179586476925286766559 (pi * 2) |
PI_BY_TWO | 1.5707963267948966192313216916398 (pi / 2) |
DEG_TO_RAD | To convert from degrees to radians (multiply, example: radian = 90 * DEG_TO_RAD;) |
RAD_TO_DEG | To convert to radians from degrees (multiply, example: degree = PI_BY_TWO * RAD_TO_DEG;) |
SQRT2 | 1.4142135623730950488016887242097 (square root of 2) |
integer
string
NULL_KEY Indicates an empty
key: "00000000-0000-0000-0000-000000000000". This constant is typed as a string not as a key.
EOF, "\n\n\n", Indicates the last line (or a line past this) of a
notecard was read (
returned in the
dataserver event), or that the
notecard contained embedded objects.
Substring | Replaced With |
\t | four spaces |
\n | new line |
\" | double quote |
\\ | backslash |
rotation
ZERO_ROTATION <0.0, 0.0, 0.0, 1.0> (Note that
ZERO_ROTATION is
not <0.0, 0.0, 0.0, 0.0>! This is important.)
vector
ZERO_VECTOR <0.0, 0.0, 0.0>
For more info see
object types
Also, see
annoyances for a partial reason for explicitly specifying floating-point constants in the vector and rotation definitions. Using integers can cause logical-looking calculations in assignments to fail in ways that can be difficult to notice at first due to the way
LSL parses numbers and handles inline math operations using the fastest data type.
Functions |
Events |
Types