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

I Need Help

Started by tbyoran, 04 August 2012 - 05:52 PM
tbyoran #1
Posted 04 August 2012 - 07:52 PM
I'm try this code , it's work but just ones time.
When i write someting , monitor is showing.
But when i try agin it say Write: test:5: attempt to call string.

Please help me , how can i write unlimited?


term.clear()
term.setCursorPos(4,5)
write "Write: "
read = read()

mon = peripheral.wrap("right")
mon.clear()
mon.setTextScale(5)
mon.setCursorPos(4,5)
mon.write(read)

MysticT #2
Posted 04 August 2012 - 08:20 PM
Don't use function names as variable names, you'r overwriting the read function with whatever it returns. So the second time you run the program, read is a string, not a function. To fix the error just change the line:

read = read()
to something like:

local input = read()
And change the last line to this:

mon.write(input)
tbyoran #3
Posted 04 August 2012 - 08:25 PM
thx a lot