Could someone tell me how i should use it and what its good for?
Concatenation is when you join together two strings. In lua, the concatenation operator is ..
Here's a quick example:
local message = "Merely" .. " has eaten a snowball."
The wiki has more information about concatenation.
String concatenation is used to combine two strings. The string concatenation "character" in Lua is
.. (two periods).
print("Hi" .. " World!") x = "yo" y = "dog" print(x .. " " .. y) -- etc
Concatenation is the combination of two Strings into one. This can be useful when you're working with any type of Strings. A good example is referencing a set of objects following a rule (obj1, obj2, obj3...).
The concatenation symbol in Lua is .. (two periods), and combines the left string with the right string.
Here's an example...
print("h" .. "i")
Say if you have a player entered script. You do it like this...
game.Players.PlayerAdded:connect(function(plr) msg = Instance.new("Message", Workspace) msg.Text = "Say welcome to "...plr.Name wait(2) msg:Destroy() end)
It basically allows strings and values to be added into something.
Concatenation is when you combine two strings. Basically, you put two dots in between two strings or other values that can be used in a string. Example:
Player = "Minifig77" WinPercentage = 100 print("Player "..Player.." wins "..WinPercentage.."% of the time!"
In the output, you would see: Player Minifig77 wins 100% of the time!
game.Players.PlayerAdded:connect(function(plr) msg = Instance.new("Name", Workspace) msg.Text = "Welcome to "Game, plr.Name! wait(2) msg:Destroy() end)
but then another man walks into the bar