Advertisement
Guest User

ticket.lua

a guest
Apr 29th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. local component = require("component")
  2. local shell = require("shell")
  3. local timeapi = require("timeapi")
  4.  
  5. local op = component.openprinter
  6.  
  7. local args, options = shell.parse(...)
  8.  
  9. local player = options.player
  10. local amt = options.amount
  11.  
  12. function timestamp(zone)
  13. tostring(zone)
  14. return timeapi.date("%Y-%m-%d %H:%M", zone)
  15. end
  16.  
  17. local timestamp = timestamp("utc")
  18.  
  19. -- init printer
  20. op.clear()
  21. op.setTitle(" ")
  22.  
  23. for x = 1,(amt or 1) do
  24.   op.setTitle("Lotto Ticket")
  25.  
  26.   op.writeln(options.player .. "'s §1L§2o§3t§4t§5o§r Ticket")
  27.   op.writeln(" ")
  28.   op.writeln("Your randomly selected")
  29.   op.writeln("numbers are as follows")
  30.   op.writeln(" ")
  31.   op.writeln(math.random(1,20) .. " - " .. math.random(1,20) .. " - " .. math.random(1,20),0x000000,true)
  32.   op.writeln(" ")
  33.   op.writeln("This lotto has been")
  34.   op.writeln("brought to you by ")
  35.   op.writeln("Miss Fortune and ")
  36.   op.writeln("Sir Prize, and was")
  37.   op.writeln("paid for by Soluna")
  38.   op.writeln("Technologies.")
  39.   op.writeln(" ")
  40.   op.writeln("Soluna Technologies:")
  41.   op.writeln("Innovation at the ")
  42.   op.writeln("speed of light.")
  43.   op.writeln(" ")
  44.   op.writeln(timestamp)
  45.  
  46.  
  47. local prnt, err =  op.print()
  48. if not prnt then
  49. io.stderr:write(err)
  50. end
  51.  
  52. op.clear()
  53. op.setTitle(" ")
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement