Jump to content




Add number to a text


  • You cannot reply to this topic
3 replies to this topic

#1 Banzai_Bill

  • Members
  • 4 posts

Posted 05 April 2013 - 09: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

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 05 April 2013 - 09: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.

#3 JokerRH

  • Members
  • 147 posts

Posted 05 April 2013 - 09:47 AM

local str = "This is number "
local num = 3

write(str..tostring(num))

#4 Banzai_Bill

  • Members
  • 4 posts

Posted 05 April 2013 - 09:55 AM

Wow! That helped Huge Thanks! :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users