Lua-miscellaneous-operator
提供:Dev Guides
Lua-その他の演算子
Lua言語でサポートされるその他の演算子には、*連結*および*長さ*が含まれます。
Operator | Description | Example |
---|---|---|
.. | Concatenates two strings. | a..b where a is "Hello " and b is "World", will return "Hello World". |
# | An unary operator that return the length of the a string or a table. | #"Hello" will return 5 |
例
Luaプログラミング言語で使用可能なその他の演算子を理解するには、次の例を試してください-
a = "Hello "
b = "World"
print("Concatenation of string a with b is ", a..b )
print("Length of b is ",#b )
print("Length of b is ",#"Test" )
上記のプログラムをビルドして実行すると、次の結果が生成されます-
Concatenation of string a with b is Hello World
Length of b is 5
Length of b is 4