Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("right") --you could change the side to what ever you like
- ink = p.getInkLevel() --get ink level from printer
- paper = p.getPaperLevel() --get paper level from printer
- if ink > 0 and paper > 0 then
- line = 1 --sets line to 1
- while true do --main loop
- input = io.read() --reads your input
- if input == "exit()" then --if input is exit() it will stop adding text to the file
- p.endPage()
- break
- else
- print("text for line " ..line..":")
- p.write(input) --writes the input to to paper
- line = line + 1 --adds 1 to line
- p.setCursorPos(1,line) --moves the cursor(position where you are going to write) 1 down
- end
- end
- else
- print("fill the printer with ink and paper please")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement