This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已动态机器翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
This content has been machine translated dynamically.
This content has been machine translated dynamically.
This content has been machine translated dynamically.
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.
Este artigo foi traduzido automaticamente.
这篇文章已经过机器翻译.放弃
Translation failed!
式
式は、変数とリテラル値から値を計算します。
- 算術演算
- 関係演算
- 論理演算
- 連結
- 長さ
- 優先順位
算術演算
算術演算は、数値に対して実行されます。算術演算で文字列値が使用されると、数値に変換されます。これが失敗すると、エラーが返されます。
a + b | aとbを加算する |
a-b | a から b を引く |
a * b | aとbを乗算する |
a/b | aをbで除算する |
a% b | modulo = a - math.floor(a/b)*b |
a^b | a を b の累乗します。b は任意の数になります。 |
-a | 否定する |
関係演算
関係演算は、2つの値を比較し、関係が満たされている場合はtrueを返し、そうでない場合はfalseを返します。関係演算は、任意の型の値間で実行できます。値が同じ型でない場合は、false が返されます。数字は通常の方法で比較されます。文字列は、現在のロケールの照合順序を使用して比較されます。
a == b | a は b に等しい |
a ~= b | a が b と等しくない |
a < b | a が b より小さい |
a > b | a が b より大きい |
a <= b | a が b 以下である |
a >= b | a が b 以上である |
論理演算
論理演算は伝統的にブール値に対して実行されますが、この言語では、任意の2つの値に対して実行できます。nilとfalseはfalseとみなされ、他の値はtrueとみなされます。論理演算はショートカット評価を使用します。最初の値が操作の結果を決定した場合、2番目の値は評価されません。
a and b | aが偽またはnilの場合、他の戻りbを返します |
a or b | aが偽でなく、nilでない場合は、他の戻りbを返します |
not a | aがfalseまたはnilでない場合はfalseを返し、それ以外の場合はtrueを返します |
andおよびor演算は、式内の条件付き評価に使用できます。
a or b | aが初期化されていない(nil)場合、デフォルト値bを提供するために使用することができます。これは、関数のオプションのパラメータに便利です。 |
a and b or c | 条件aに基づいて非nil bまたはcを選択するために使用できます。aが真の場合、aとbはbを返し、bまたはcはaが偽の場合、aとbは偽を返し、またはcはcを返します。これは、? b:Cプログラミング言語のc。 |
連結
文字列の連結は s1.. s2 です。これにより、s1とs2の内容を保持するのに十分な大きさの新しい文字列が作成され、その内容が新しい文字列にコピーされます。s1 または s2 が文字列でない場合は、エラーが発生します。連結を繰り返すと、かなりのコピーオーバーヘッドが生じる可能性があることに注意してください。一度に1バイトを連結してnバイトの文字列を作成すると、n*(n+1)/2バイトをコピーします。パフォーマンスを向上させるには、文字列の一部を連結してテーブル(後述)に配置し、table.concat()関数を使用できます。この例は、COMBINE_HEADERS () の例に示されています。
長さ
文字列 s の長さは #s によって返されます。#演算子は、後で説明するように、配列テーブルでも使用されます。
優先順位
演算子の優先順位は、式内で実行される演算の順序を決定します。優先順位の高い演算は、優先順位の低い演算よりも優先されます。優先順位の順序は、いつものように括弧で上書きすることができます。たとえば、a + b \* c
では、* は + よりも優先順位が高いため、式はa + (b \* c)
として評価されます。
最高 | ^ |
- | not # - (unary) |
- | * / % |
- | .. |
- | = ~= < > <= >= |
- | および |
最低 | または |
優先順位が同じ操作は左から右 (左結合) に実行されます。ただし、^ と.. は右から左 (右結合) に実行されます。したがって、^ b ^ cはa^(b ^ c)として評価されます。
共有
共有
This Preview product documentation is Citrix Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Citrix Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Citrix product purchase decisions.
If you do not agree, select Do Not Agree to exit.