Advertisement
Guest User

xerox.lua

a guest
Oct 6th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. --[[
  2.     xerox.lua  A simple program for copying OpenPrinter Printed Pages
  3.     Version 0.25
  4.    
  5.     TODO:
  6.       Add scan to file via my custom lib
  7.       Probably fix the amount counting
  8. ]]
  9.  
  10. local component = require("component")
  11. local kodos = require("kodos")
  12. local shell = require("shell")
  13.  
  14. local printer = component.openprinter
  15.  
  16. printer.clear()
  17.  
  18. local args, options = shell.parse(...)
  19.  
  20. local amt = tonumber(args[1])
  21.  
  22.  
  23. if amt > 9 then
  24. error("cannot print more than 9 items")
  25. elseif amt < 1 then
  26. error("invalid count")
  27. end
  28.  
  29. local lines = printer.scan()
  30.  
  31. for cnt = 1,(amt or 1) do
  32. for x = 0,#lines do
  33. printer.writeln(lines[x])
  34. end
  35. printer.print()
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement