Typecast
From Second Life Wiki
Typecast
| LSL Portal | | | Functions | | | Events | | | Types | | | Operators | | | Constants | | | Flow Control | | | Script Library | | | Tutorials |
Contents |
To convert the type of a value a typecast is required. There are two types of typecasting, explicit and implicit. Explicit typecasts must be provided by the programmer, but implicit typecasts are put in place by the compiler. LSL implicitly typecasts strings to keys and integers to floats where the latter type is required but the former is provided.
| Supported Typecasts | ||||||||
|---|---|---|---|---|---|---|---|---|
| To | ||||||||
| integer | float | string | key | list | vector | rotation | ||
| From | integer | x | x | x | x | |||
| float | x | x | x | x | ||||
| string | x | x | x | x | x | x | x | |
| key | x | x | x | |||||
| list | x | x | ||||||
| vector | x | x | x | |||||
| rotation | x | x | x | |||||
Syntax: (type)value
Converts value to type.
| • expression | type | – | variable type | |
| • expression | value | – | expression or constant |
If value is a complex expression, it may be beneficial to wrap it in parentheses. (type)(value)

