In Java you can have:
String name = "myNameis";
String myString = name + "myName";
How do have the plus sign (demonstrated above) in Lua
In Java you can have:
String name = "myNameis";
String myString = name + "myName";
How do have the plus sign (demonstrated above) in Lua
The concatenation operator in Lua is .., unlike other languages such as Java, Python, etc.
So it would be name .. "myName".
If you really want to use +, you can overload the + operator to do so.
getmetatable("").__add = function(a, b)
return a .. b
end
This will NOT work on Roblox.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Do myString = name.."myName"
Thanks, that works
No problem