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

Add number to a text

Started by Banzai_Bill, 05 April 2013 - 08:37 AM
Banzai_Bill #1
Posted 05 April 2013 - 10:37 AM
Hi, I want to add a special number to a text.
Something like this:

term.clear()
y="NUMBER:"
x="0"
for t=1,100 do
x=x+1
(  y=x+y )
printer.write(y)
end
Thx for replys :)/>

~MICRO
Kingdaro #2
Posted 05 April 2013 - 10:41 AM
That can be accomplished pretty easily.

term.clear()
for i=1, 100 do
  printer.write('NUMBER: '..i)
end

Which will (technically) produce:

NUMBER: 1NUMBER: 2NUMBER: 3NUM
BER: 4NUMBER: 5NUMBER: 6NUMBER
: 7NUMBER: 8NUMBER:9NUMBER: 10
NUMBER: 11NUMBER: 12NUMBER: 13
NUMBER: 14NUMBER: 15NUMBER: 16
...

Because there aren't any new lines being inserted.
JokerRH #3
Posted 05 April 2013 - 10:47 AM
local str = "This is number "
local num = 3

write(str..tostring(num))
Banzai_Bill #4
Posted 05 April 2013 - 10:55 AM
Wow! That helped Huge Thanks! :D/>