Concatenation in Lua

Find this useful? Support us: Star on GitHub 6
Category: String | Language: Lua

In Lua, you can concatenate strings using the .. operator.

Here's an example:

str1 = "Hello"
str2 = "world"
result = str1 .. " " .. str2
print(result)

Output:

Hello world

In this example, we are concatenating str1 and str2 with a space in between using the .. operator and storing the result in the result variable. Finally, we are printing the concatenated string using the print function.