Advertisement
Guest User

printing.lua

a guest
Sep 22nd, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. print("Please insert the train number")
  2. local trainNumber = read()
  3. print("Please insert the customer's name")
  4. local customer = read()
  5. sleep(1)
  6. print("The ticketis printed.")
  7. local printer
  8. local printer=peripheral.wrap("printer_1")
  9.  
  10.  
  11. printer.newPage()
  12. printer.write("TRAIN TICKET")
  13. printer.setCursorPos(1,2)
  14. printer.write("TRAIN NUMBER: " .. trainNumber)
  15. printer.setCursorPos(1,3)
  16. printer.write("CUSTOMER: " .. customer)
  17. --[[printer.setCursorPos(1,3)
  18. printer.setCursorPos(1,2)
  19. printer.print(customer)
  20. --]]
  21. local w, h=printer.getPageSize()
  22. printer.setCursorPos(1, h)
  23. printer.write("TrainTrans INC.")
  24.  
  25. local str="TrainTrans INC"
  26. for i=1,#str do
  27.   printer.setCursorPos(w,i)
  28.   printer.write(string.sub(str,i,i))
  29. end
  30. printer.setPageTitle("Ticket")
  31. printer.endPage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement