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

write function problem

Started by BlueZero, 13 June 2013 - 04:46 AM
BlueZero #1
Posted 13 June 2013 - 06:46 AM
I'm making a little bit of an ASCII GUI for my program. I managed to get the location of everything fixed properly so it'll display nicely but for some reason it doesn't want to work that way.

Here's my code:


function gateKeeper()
  shell.run("clear")
  term.setCursorPos(15,7)
  write("Bluelock 2.0 running ")
  term.setCursorPos(15,8)
  write("on computer: ", os.getComputerID()) -- won't display computer ID
  term.setCursorPos(15,9)
  write("OS Version: ", os.version()) -- won't display os version
  term.setCursorPos(15,10)
  write("To view credits")
  term.setCursorPos(15,11)
  write("type \"credits\".")
  term.setCursorPos(15,13)
  write("Password: ")
  input = io.read()
  shell.run("clear")
end

I'm not sure what I'm doing wrong. It'd normally display something but I'm getting a blank spot for where the computer ID and the OS Version would be. I'm wondering if I got something wrong here?
theoriginalbit #2
Posted 13 June 2013 - 06:53 AM
The problem is because the write function, unlike the print function, does not allow for multiple arguments. So change the comma's to the concat operator (..)
So instead of

write("on computer: ", os.getComputerID())
it should be

write("on computer: "..os.getComputerID())
BlueZero #3
Posted 13 June 2013 - 06:55 AM
The problem is because the write function, unlike the print function, does not allow for multiple arguments. So change the comma's to the concat operator (..)
So instead of

write("on computer: ", os.getComputerID())
it should be

write("on computer: "..os.getComputerID())

AW! I didn't know this! Lol, now I'm lookin' silly. Thanks man. Forgot all about the concat operator.
theoriginalbit #4
Posted 13 June 2013 - 06:59 AM
haha thats ok, we all have our momentary lapses of judgement. No one is perfect, thats why we need bug trackers and beta tests, etc.