for an example
table1 = {"item1","item2","item3"}
function scroll(table)
--scroll through items on a table
end
scroll(table1)
that will outputitem1 | item2 | item3 | item1 | item2 | item3 | ite
and continue scrolling like that.
table1 = {"item1","item2","item3"}
function scroll(table)
--scroll through items on a table
end
scroll(table1)
that will output
function scroll(tab) --#table is a global variable, so I will use tab
start.x, start.y = term.getCursorPosition() --#this is in 1.74 only (I think). An alternative is to pass these as parameters. Also I may be getting the function names slightly wrong
for i, #tab do
term.setCursorPosition(unpack(start))
print(tab[i]) --#this may leave some leftover characters from the previous string
--#a solution to above comment would be to print spaces till this combined string is the same length as the longest one in your table
sleep(1000)--#wait one second so we can see it
end--#for loop
end--#function
function scroll(tab) --#table is a global variable, so I will use tab
start.x, start.y = term.getCursorPos() --#this is in 1.74 only (I think). An alternative is to pass these as parameters.
for i, #tab do
term.setCursorPos(unpack(start))
print(tab[i]) --#this may leave some leftover characters from the previous string
--#a solution to above comment would be to print spaces till this combined string is the same length as the longest one in your table
sleep(1000)--#wait one second so we can see it
end--#for loop
end--#function
Just want to point out that in both of your code-snippets you put this- snip -
sleep( 1000 )
That wouldn't sleep 1 second, it would sleep 1000 seconds, remember that it works differently in ComputerCraft :P/>Just want to point out that in both of your code-snippets you put this- snip -That wouldn't sleep 1 second, it would sleep 1000 seconds, remember that it works differently in ComputerCraft :P/>sleep( 1000 )
nvm, i found out a way to do it :)/>/>