Hello,
Im trying to make text on the screen span from one end to the other without having to count the spaces, or basically trial and error it.
Here's what ive been doing......
Term.setCursorPos(1,1)
print("____________________________________________")
Thats waht ive done before, im trying to get it so if i attach a monitor of larger size it spans that monitor length. Im am somewhat new to coding, so srry im confusing the F*** out of you, but please help in anyway!
Thanks!
[LUA] program question. HELP ASAP
Started by predatorxil, Aug 30 2012 11:20 PM
4 replies to this topic
#1
Posted 30 August 2012 - 11:20 PM
#2
Posted 31 August 2012 - 01:07 AM
Try doing something like this. I haven't tested it but it should work.
You will probably want to set the line number that you want to print it on.
local x, y = term.getSize() -- x is the lines, y is the characters on the line
for a=1, y do
write("_")
end
You will probably want to set the line number that you want to print it on.
#3
Posted 31 August 2012 - 01:12 AM
luanub, on 31 August 2012 - 01:07 AM, said:
Try doing something like this. I haven't tested it but it should work.
You will probably want to set the line number that you want to print it on.
local x, y = term.getSize() -- x is the lines, y is the characters on the line
for a=1, y do
write("_")
end
You will probably want to set the line number that you want to print it on.
function drawLine(nLine,character) local x, y = term.getSize() term.setCursorPos(1,nLine) for i = 1,x do write(character) end end
#4
Posted 31 August 2012 - 01:18 AM
awsumben13, on 31 August 2012 - 01:12 AM, said:
luanub, on 31 August 2012 - 01:07 AM, said:
Try doing something like this. I haven't tested it but it should work.
You will probably want to set the line number that you want to print it on.
local x, y = term.getSize() -- x is the lines, y is the characters on the line
for a=1, y do
write("_")
end
You will probably want to set the line number that you want to print it on.
function drawLine(nLine,character) local x, y = term.getSize() term.setCursorPos(1,nLine) for i = 1,x do write(character) end end
lol you're right I had them backwards..
#5
Posted 31 August 2012 - 03:08 AM
You know, you could just use string.rep(), it's easier than using a for loop.
function drawLine(nLine, sChar) local w,h = term.getSize() print(string.rep(sChar, w)) end
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











