文字列

Luaでは、簡単な文字列の割り当てと連結を直接実行できます。より高度な文字列操作は、stringモジュール(Fekoのインストール環境にインストールされています)を使用して実行できます。

文字列を連結するには、2つのピリオド(“..”)を使用します。“#”演算子は、文字列の長さを返します。stringモジュールは、代入などのより高度な文字列操作に使用します。

print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings. ' )
a = ' hello '
print( ' The # operator says there are ' .. #a .. ' letters in " ' .. a .. ' ". ' )
print(a .. ' becomes ' .. string.gsub(a, ' h ' , ' y ' ))