Category:LSL Integer/ja
LSL ポータル | 関数 | イベント | 型 | 演算子 | 定数 | 実行制御 | スクリプトライブラリ | カテゴリ別スクリプトライブラリ | チュートリアル |
Integers
integerデータ型は−2,147,483,648 〜 +2,147,483,647 (16進数で0x00000000 〜 0xFFFFFFFF)の範囲の符号付きの32ビットの値です。integerは整数の数値です。小数点が必要な場合は, floatを使用します。
DEBUG_CHANNELはintegerの最大値の定数として使用することができます。
例
以下は全てintegerです。
integer firstInt = 5512623;
integer secondInt = ACTIVE;
integer thridInt = 0x61EC1A;
integer fourthInt = -160693;
以下のものはintegerではなく、floatを使います。
integer firstInt = 125.2; //エラー integerは小数点を含むことはできません。
integer bigValue = 3147483647; // -1,147,483,649 と表示される integerは2,147,483,647をより大きな数値を扱うことはできません。
integer secondInt = 10000000000; // -1と表示される integerは2,147,483,647より大きな数値を扱うことはできません。
以下の関数は、文字列が整数のみで構成されているかどうかを判定するために使用できます。これは、チャットやテキストボックスに有効な整数が入力されたかどうかを知る必要がある場合に重要です。
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;
}
「こちらは、正または負の10進整数を含む文字列用のよりシンプルな解決策です(+記号、先頭のゼロ、または千の区切り ',' なしで表現された-2147483648から2147483647までの値) Omei Qunhua.
if ( (string) ( (integer) data) == data)
llOwnerSay("'" + data + "' contains a valid integer");
以下の例は、文字列が文字0から9までしか含まないことを検証します。 Omei Qunhua.
a) 文字列の長さが5の例
StringOf5Dec(string test)
{
return ( (integer) ("1" + test) >= 100000);
}
b) 文字列の長さが1から9までの例
VarStringIsDecimal(string test)
{
integer limit = (integer) llPow(10.0, llStringLength(test) );
return ( (integer) ("1" + test) >= limit);
}
この関数は、符号や先頭のゼロの有無にかかわらず、先頭/末尾のスペースを含むが、千の区切り記号は受け付けない任意の10進整数を検証するはずです。(Phil Metalhead)
integer uIsInteger(string input)
{
input = llStringTrim(input,STRING_TRIM); // remove leading/trailing whitespace
// "+123" is a valid integer string but would otherwise fail, so strip leading "+" if it's there
if (llGetSubString(input,0,0) == "+") input = llGetSubString(input,1,-1);
return ((string)((integer)input) == input);
}
上記の関数のテストケース(ページの右側にある「Expand」リンクをクリックしてください):
///////////////
// Returns 1 // (leading and trailing whitespace)
2352316
///////////////
// Returns 1 // (leading "+")
+151613662
///////////////
// Returns 1 // (negative number)
-263163626
///////////////
// Returns 1 // (largest positive integer)
2147483647
///////////////
// Returns 1 // (largest negative integer)
-2147483648
///////////////
// Returns 1 // (largest positive integer with leading and trailing whitespace, and leading "+")
+2147483647
///////////////
// Returns 0 // (contains letters)
161362stuff
///////////////
// Returns 0 // (number is a float, not an integer -- contains "." in string)
123.4
///////////////
// Returns 0 // (whitespace in middle of string)
2347
9089
///////////////
// Returns 0 // (contains thousands separator ",")
844,241
// Returns 0 // ("+" in middle of string)
2378+87668
///////////////
// Returns 0 // ("-" in middle of string)
3462098-12
// Returns 0 // (number > 2147483647)
2147483648
///////////////
// Returns 0 // (number < -2147483648)
-2147483649
///////////////
Further Reading
整数のさまざまな使用方法、特にLSL(Linden Scripting Language)での使用方法を含む、より広範なカバレッジについては、次を参照してください。 LSL in Focus: Integers.
Pages in category "LSL Integer/ja"
The following 200 pages are in this category, out of 411 total.
(previous page) (next page)A
- LlAbs/ja
- ACTIVE/ja
- AGENT/ja
- AGENT ALWAYS RUN/ja
- AGENT ATTACHMENTS/ja
- AGENT AUTOPILOT/ja
- AGENT AWAY/ja
- AGENT BUSY/ja
- AGENT BY LEGACY NAME/ja
- AGENT BY USERNAME/ja
- AGENT CROUCHING/ja
- AGENT FLYING/ja
- AGENT IN AIR/ja
- AGENT MOUSELOOK/ja
- AGENT ON OBJECT/ja
- AGENT SCRIPTED/ja
- AGENT SITTING/ja
- AGENT TYPING/ja
- AGENT WALKING/ja
- ALL SIDES/ja
- ANIM ON/ja
- ATTACH BACK/ja
- ATTACH BELLY/ja
- ATTACH CHEST/ja
- ATTACH CHIN/ja
- ATTACH HEAD/ja
- ATTACH HUD BOTTOM/ja
- ATTACH HUD BOTTOM LEFT/ja
- ATTACH HUD BOTTOM RIGHT/ja
- ATTACH HUD CENTER 1/ja
- ATTACH HUD CENTER 2/ja
- ATTACH HUD TOP CENTER/ja
- ATTACH HUD TOP LEFT/ja
- ATTACH HUD TOP RIGHT/ja
- ATTACH LEAR/ja
- ATTACH LEFT PEC/ja
- ATTACH LEYE/ja
- ATTACH LFOOT/ja
- ATTACH LHAND/ja
- ATTACH LHIP/ja
- ATTACH LLARM/ja
- ATTACH LLLEG/ja
- ATTACH LSHOULDER/ja
- ATTACH LUARM/ja
- ATTACH LULEG/ja
- ATTACH MOUTH/ja
- ATTACH NOSE/ja
- ATTACH PELVIS/ja
- ATTACH REAR/ja
- ATTACH REYE/ja
- ATTACH RFOOT/ja
- ATTACH RHAND/ja
- ATTACH RHIP/ja
- ATTACH RIGHT PEC/ja
- ATTACH RLARM/ja
- ATTACH RLLEG/ja
- ATTACH RSHOULDER/ja
- ATTACH RUARM/ja
- ATTACH RULEG/ja
C
- CAMERA ACTIVE/ja
- CAMERA BEHINDNESS ANGLE/ja
- CAMERA BEHINDNESS LAG/ja
- CAMERA DISTANCE/ja
- CAMERA FOCUS/ja
- CAMERA FOCUS LAG/ja
- CAMERA FOCUS LOCKED/ja
- CAMERA FOCUS OFFSET/ja
- CAMERA FOCUS THRESHOLD/ja
- CAMERA PITCH/ja
- CAMERA POSITION/ja
- CAMERA POSITION LAG/ja
- CAMERA POSITION LOCKED/ja
- CAMERA POSITION THRESHOLD/ja
- CHANGED ALLOWED DROP/ja
- CHANGED COLOR/ja
- CHANGED INVENTORY/ja
- CHANGED LINK/ja
- CHANGED MEDIA/ja
- CHANGED OWNER/ja
- CHANGED REGION/ja
- CHANGED REGION START/ja
- CHANGED SCALE/ja
- CHANGED SHAPE/ja
- CHANGED TELEPORT/ja
- CHANGED TEXTURE/ja
- CLICK ACTION BUY/ja
- CLICK ACTION NONE/ja
- CLICK ACTION OPEN/ja
- CLICK ACTION OPEN MEDIA/ja
- CLICK ACTION PAY/ja
- CLICK ACTION PLAY/ja
- CLICK ACTION SIT/ja
- CLICK ACTION TOUCH/ja
- CONTROL BACK/ja
- CONTROL DOWN/ja
- CONTROL FWD/ja
- CONTROL LBUTTON/ja
- CONTROL LEFT/ja
- CONTROL ML LBUTTON/ja
- CONTROL RIGHT/ja
- CONTROL ROT LEFT/ja
- CONTROL ROT RIGHT/ja
- CONTROL UP/ja
D
F
H
I
L
- LAND LEVEL/ja
- LAND LOWER/ja
- LAND NOISE/ja
- LAND RAISE/ja
- LAND REVERT/ja
- LAND SMOOTH/ja
- LINK ALL CHILDREN/ja
- LINK ALL OTHERS/ja
- LINK ROOT/ja
- LINK SET/ja
- LINK THIS/ja
- LIST STAT GEOMETRIC MEAN/ja
- LIST STAT MAX/ja
- LIST STAT MEAN/ja
- LIST STAT MEDIAN/ja
- LIST STAT MIN/ja
- LIST STAT NUM COUNT/ja
- LIST STAT RANGE/ja
- LIST STAT STD DEV/ja
- LIST STAT SUM/ja
- LIST STAT SUM SQUARES/ja
- LOOP/ja
O
P
- PARCEL DETAILS ID/ja
- PARCEL COUNT GROUP/ja
- PARCEL COUNT OTHER/ja
- PARCEL COUNT OWNER/ja
- PARCEL COUNT SELECTED/ja
- PARCEL COUNT TEMP/ja
- PARCEL COUNT TOTAL/ja
- PARCEL DETAILS AREA/ja
- PARCEL DETAILS DESC/ja
- PARCEL DETAILS GROUP/ja
- PARCEL DETAILS NAME/ja
- PARCEL DETAILS OWNER/ja
- PARCEL FLAG ALLOW ALL OBJECT ENTRY/ja
- PARCEL FLAG ALLOW CREATE GROUP OBJECTS/ja
- PARCEL FLAG ALLOW CREATE OBJECTS/ja
- PARCEL FLAG ALLOW DAMAGE/ja
- PARCEL FLAG ALLOW FLY/ja
- PARCEL FLAG ALLOW GROUP OBJECT ENTRY/ja
- PARCEL FLAG ALLOW GROUP SCRIPTS/ja
- PARCEL FLAG ALLOW LANDMARK/ja
- PARCEL FLAG ALLOW SCRIPTS/ja
- PARCEL FLAG ALLOW TERRAFORM/ja
- PARCEL FLAG LOCAL SOUND ONLY/ja
- PARCEL FLAG RESTRICT PUSHOBJECT/ja
- PARCEL FLAG USE ACCESS GROUP/ja
- PARCEL FLAG USE ACCESS LIST/ja
- PARCEL FLAG USE BAN LIST/ja
- PARCEL FLAG USE LAND PASS LIST/ja
- PARCEL MEDIA COMMAND AGENT/ja
- PARCEL MEDIA COMMAND AUTO ALIGN/ja