Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How have a string perform like Java?

In Java you can have:

String name = "myNameis";
String myString = name + "myName";

How do have the plus sign (demonstrated above) in Lua

3 comments

0

Do myString = name.."myName"

0

Thanks, that works

0

No problem

1 answer

✓ Accepted answer

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.

tfw Java has no operator overloading
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.