Posted 09 May 2014 - 12:17 AM
Im trying to make a simple program for my server, for admin applications, but when someone types something too long, it goes off the page. Any fix?
local text = "blah";
local sX, sY = printer.getPageSize();
local lines = math.ceil(#text / sX)
for y = 1, lines do
local start = ((y - 1) * sX) + 1;
local finish = y * sX;
printer.setCursorPos(1, y)
printer.write(text:sub(start, finish));
end
The math seemed to have worked out in my head, though I'm not sure it's entirely correct.printer = peripheral.wrap( "side" )
local px , py = printer.getPageSize()
if px > "however long a page is" then
-- cancel the input by using something.
but HometownPotato has a better code with that part. (IF it does work)