Don't click here unless you want to be banned.

LSL Wiki : integer

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are


An integer is a signed, 32-bit value with valid range from -2147483648 to 2147483647 (that is 0x80000000 to 0x7FFFFFFF in hex). LSL does not have an unsigned integer type.


An integer is a whole number (no decimals). If you want decimals, you want a float.

As of Second Life 1.5, integers can be entered in hexadecimal (e.g. 0xff, 0x10, 0xF0AB, 0x20baef49 etc...) Strings typecast to integers also take these formats into account.

integer dec = 42; // 42 decimal
integer hex = 0xff; // 255 decimal

Octal support was added in 1.5.0 and removed in 1.5.2 because it caused incompatabilities with some existing scripts. The Lindens have not mentioned any plans to bring it back.

To round a float to an integer, use llRound.

Beware, a integer variable assigned a value larger/smaller than the valid range is instead assigned a value of -1.
// Watch out! This will compile, but will result in x having the value of -1.
integer x = 12345678900000;

Types | Bitwise | Bitfield | Binary | Memory Usages
There are 3 comments on this page. [Display comments/form]