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

How to combine things in "write()"

Started by ChaddJackson12, 04 September 2012 - 07:35 PM
ChaddJackson12 #1
Posted 04 September 2012 - 09:35 PM
How to combine this code into one statement?


write("\nCancellation For ") write(formalname1) write(" Successful!")

I don't really want to have to type write that many times.. And with textutils.slowPrint(), it doesn't work very well at all either. Any help? And can someone explain it as well for textutils.slowPrint()?

Thanks.
OmegaVest #2
Posted 04 September 2012 - 09:41 PM
Mmm. You could make the three strings into one via concatenation ( .. ).


outWrite = "/nCancellation For " .. formalname1 .. " Successful!"
write(outWrite)

And I think slowPrint is supposed to work with an array (ie. "/nCancellation For ", formalname, " Successful!"), but I don't know.
Zalerinian #3
Posted 05 September 2012 - 01:11 AM
How to combine this code into one statement?


write("nCancellation For ") write(formalname1) write(" Successful!")

I don't really want to have to type write that many times.. And with textutils.slowPrint(), it doesn't work very well at all either. Any help? And can someone explain it as well for textutils.slowPrint()?

Thanks.

As well as what Omega said, you could have this:


write("nCancellation For "..formalname1.." Successful!")

The only difference really is it saves you the use of another variable.
ChaddJackson12 #4
Posted 05 September 2012 - 03:34 PM
How to combine this code into one statement?


write("nCancellation For ") write(formalname1) write(" Successful!")

I don't really want to have to type write that many times.. And with textutils.slowPrint(), it doesn't work very well at all either. Any help? And can someone explain it as well for textutils.slowPrint()?

Thanks.

As well as what Omega said, you could have this:


write("nCancellation For "..formalname1.." Successful!")

The only difference really is it saves you the use of another variable.
Ok thanks, I have tryed these statements (below) but haven't tryed this one.

write("Stuff", something, "More Stuff)
write(something, "More Stuff")
write("Stuff" + something + "More Stuff")