This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DaWooShit's profile picture

How do I add strings together.

Started by DaWooShit, 08 October 2012 - 06:55 PM
DaWooShit #1
Posted 08 October 2012 - 08:55 PM
Title says it all.
Example (how you would do in python):
"hoi" + "hi" = "hoihi"

I have no clue of how to do this in lua.
Pinkishu #2
Posted 08 October 2012 - 09:00 PM
"hoi".."hi"
nolongerexistant #3
Posted 08 October 2012 - 10:22 PM
You could do


a = "text"

b = read()

print(a..:D/>/> -- That b is made a capital automatic?..
BrolofTheViking #4
Posted 08 October 2012 - 10:24 PM
As Pinkishu said, .. is concatenation in Lua. Python treats + as both addition and concatenation, depending on the situation, but for Lua you have to use .. to concatenate strings.