Category:LSL Integer
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Integers
The integer data type is a signed 32 bit value between −2,147,483,648 and +2,147,483,647 (that is 0x80000000 to 0x7FFFFFFF in hex). Integers are whole numbers. The fractional datatype is the float.
DEBUG_CHANNEL can be used as a constant for the maximum integer (for that is the value it is defined as).
Examples
All of the following are integers: <lsl>integer firstInt = 5512623; integer secondInt = ACTIVE; integer thirdInt = 0x61EC1A; integer fourthInt = -160693;</lsl>
The following are NOT integers, use float for them: <lsl> integer decimalValue = 125.2; // ERROR : Type mismatch -- Integer literals can't have a decimal. integer bigValue = 3147483647; // An undocumented way to say -1,147,483,649 // Integer literals can't be larger than 2,147,483,647. integer biggerValue = 10123456789; // An undocumented way to say -1 // Integer literals can't be larger than 2,147,483,647. </lsl>
The following function can be used to determine whether a string of characters consists only of integers. This can be important if you need to know that a user has entered a valid integer in chat or a textbox, for example. <lsl> integer IsInteger(string var) {
integer i; for (i=0;i<llStringLength(var);++i) { if(!~llListFindList(["1","2","3","4","5","6","7","8","9","0"],[llGetSubString(var,i,i)])) { return FALSE; } } return TRUE;
}</lsl>
Here's a simpler solution for strings containing positive or negative decimal integers (values from −2147483648 and 2147483647 written without + sign, leading zeros, or thousands separators ',' ).
<lsl>
if ( (string) ( (integer) data) == data) llOwnerSay("'" + data + "' contains a valid integer");
</lsl>
Further Reading
For a more extensive coverage of integers, including the different ways they are used in LSL, see LSL in Focus: Integers.
Subcategories
This category has the following 19 subcategories, out of 19 total.
I
Pages in category "LSL Integer"
The following 200 pages are in this category, out of 658 total.
(previous page) (next page)A
- LlAbs
- ACTIVE
- AGENT
- AGENT ALWAYS RUN
- AGENT ATTACHMENTS
- AGENT AUTOMATED
- AGENT AUTOPILOT
- AGENT AWAY
- AGENT BUSY
- AGENT BY LEGACY NAME
- AGENT BY USERNAME
- AGENT CROUCHING
- AGENT FLYING
- AGENT IN AIR
- AGENT LIST PARCEL
- AGENT LIST PARCEL OWNER
- AGENT LIST REGION
- AGENT MOUSELOOK
- AGENT ON OBJECT
- AGENT SCRIPTED
- AGENT SITTING
- AGENT TYPING
- AGENT WALKING
- ALL SIDES
- ANIM ON
- ATTACH AVATAR CENTER
- ATTACH BACK
- ATTACH BELLY
- ATTACH CHEST
- ATTACH CHIN
- ATTACH FACE JAW
- ATTACH FACE LEAR
- ATTACH FACE LEYE
- ATTACH FACE REAR
- ATTACH FACE REYE
- ATTACH FACE TONGUE
- ATTACH GROIN
- ATTACH HEAD
- ATTACH HIND LFOOT
- ATTACH HIND RFOOT
- ATTACH HUD BOTTOM
- ATTACH HUD BOTTOM LEFT
- ATTACH HUD BOTTOM RIGHT
- ATTACH HUD CENTER 1
- ATTACH HUD CENTER 2
- ATTACH HUD TOP CENTER
- ATTACH HUD TOP LEFT
- ATTACH HUD TOP RIGHT
- ATTACH LEAR
- ATTACH LEFT PEC
- ATTACH LEYE
- ATTACH LFOOT
- ATTACH LHAND
- ATTACH LHAND RING1
- ATTACH LHIP
- ATTACH LLARM
- ATTACH LLLEG
- ATTACH LSHOULDER
- ATTACH LUARM
- ATTACH LULEG
- ATTACH LWING
- ATTACH MOUTH
- ATTACH NECK
- ATTACH NOSE
- ATTACH PELVIS
- ATTACH REAR
- ATTACH REYE
- ATTACH RFOOT
- ATTACH RHAND
- ATTACH RHAND RING1
- ATTACH RHIP
- ATTACH RIGHT PEC
- ATTACH RLARM
- ATTACH RLLEG
- ATTACH RSHOULDER
- ATTACH RUARM
- ATTACH RULEG
- ATTACH RWING
- ATTACH TAIL BASE
- ATTACH TAIL TIP
C
- CAMERA ACTIVE
- CAMERA BEHINDNESS ANGLE
- CAMERA BEHINDNESS LAG
- CAMERA DISTANCE
- CAMERA FOCUS
- CAMERA FOCUS LAG
- CAMERA FOCUS LOCKED
- CAMERA FOCUS OFFSET
- CAMERA FOCUS THRESHOLD
- CAMERA PITCH
- CAMERA POSITION
- CAMERA POSITION LAG
- CAMERA POSITION LOCKED
- CAMERA POSITION THRESHOLD
- CHANGED ALLOWED DROP
- CHANGED COLOR
- CHANGED INVENTORY
- CHANGED LINK
- CHANGED MEDIA
- CHANGED OWNER
- CHANGED REGION
- CHANGED REGION START
- CHANGED RENDER MATERIAL
- CHANGED SCALE
- CHANGED SHAPE
- CHANGED TELEPORT
- CHANGED TEXTURE
- CHARACTER ACCOUNT FOR SKIPPED FRAMES
- CHARACTER AVOIDANCE MODE
- CHARACTER DESIRED SPEED
- CHARACTER DESIRED TURN SPEED
- CHARACTER LENGTH
- CHARACTER MAX ACCEL
- CHARACTER MAX DECEL
- CHARACTER MAX SPEED
- CHARACTER MAX TURN RADIUS
- CHARACTER ORIENTATION
- CHARACTER RADIUS
- CHARACTER STAY WITHIN PARCEL
- CHARACTER TYPE
- CHARACTER TYPE A
- CHARACTER TYPE B
- CHARACTER TYPE C
- CHARACTER TYPE D
- CHARACTER TYPE NONE
- CLICK ACTION BUY
- CLICK ACTION IGNORE
- CLICK ACTION NONE
- CLICK ACTION OPEN
- CLICK ACTION OPEN MEDIA
- CLICK ACTION PAY
- CLICK ACTION PLAY
- CLICK ACTION SIT
- CLICK ACTION DISABLED
- CLICK ACTION TOUCH
- CLICK ACTION ZOOM
- COMBAT CHANNEL
- CONTENT TYPE ATOM
- CONTENT TYPE FORM
- CONTENT TYPE HTML
- CONTENT TYPE JSON
- CONTENT TYPE LLSD
- CONTENT TYPE RSS
- CONTENT TYPE TEXT
- CONTENT TYPE XHTML
- CONTENT TYPE XML
- CONTROL BACK
- CONTROL DOWN
- CONTROL FWD
- CONTROL LBUTTON
- CONTROL LEFT
- CONTROL ML LBUTTON
- CONTROL RIGHT
- CONTROL ROT LEFT
- CONTROL ROT RIGHT
- CONTROL UP
D
E
G
- GAME CONTROL AXIS LEFTX
- GAME CONTROL AXIS LEFTY
- GAME CONTROL AXIS RIGHTX
- GAME CONTROL AXIS RIGHTY
- GAME CONTROL AXIS TRIGGERLEFT
- GAME CONTROL AXIS TRIGGERRIGHT
- GAME CONTROL BUTTON A
- GAME CONTROL BUTTON B
- GAME CONTROL BUTTON BACK
- GAME CONTROL BUTTON DPAD DOWN
- GAME CONTROL BUTTON DPAD LEFT
- GAME CONTROL BUTTON DPAD RIGHT
- GAME CONTROL BUTTON DPAD UP
- GAME CONTROL BUTTON GUIDE
- GAME CONTROL BUTTON LEFTSHOULDER
- GAME CONTROL BUTTON LEFTSTICK
- GAME CONTROL BUTTON MISC1
- GAME CONTROL BUTTON PADDLE1
- GAME CONTROL BUTTON PADDLE2
- GAME CONTROL BUTTON PADDLE3
- GAME CONTROL BUTTON PADDLE4