Advertisement
MrDionesalvi

Lego la voglio bene

Jul 2nd, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. --lego11 ti v voglioo beneeeeee
  2. local lbl = "Hotel1"
  3. local tabr = {}
  4. local m = peripheral.wrap("left")
  5. function clear()
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. end
  9.  
  10.  
  11. function cartaNonValida()
  12. clear()
  13. mon.write("Carta")
  14. monLinea2()
  15. mon.write("non")
  16. monLinea3()
  17. mon.write("valida!")
  18. print("Carta non valida o corrotta.")
  19. print("")
  20. print("Premere un tasto per uscire")
  21. os.pullEvent("key")
  22. clear()
  23. exit()
  24. end
  25.  
  26. function cartaVuota()
  27. clear()
  28. mon.write("Carta")
  29. monLinea2()
  30. mon.write("vuota!")
  31. print("Carta smagnetizzata o vuota.")
  32. print("")
  33. print("Premere un tasto per uscire")
  34. os.pullEvent("key")
  35. clear()
  36. exit()
  37. end
  38.  
  39.  
  40. clear()
  41. print("Pagamento")
  42. print("")
  43. print("Inserire la carta")
  44.  
  45. m.setInsertCardLight(true)
  46. za,rawcarta = os.pullEvent("mag_swipe")
  47. m.setInsertCardLight(false)
  48.  
  49. if rawcarta == nil then
  50. cartaVuota()
  51. end
  52.  
  53. tab = textutils.unserialize(rawcarta)
  54.  
  55. if type(tab) ~= "table" then
  56. cartaNonValida()
  57. end
  58.  
  59. if tab.t ~= "Hotel" then
  60. cartaNonValida()
  61. end
  62.  
  63. print("Premere un tasto per uscire")
  64. os.pullEvent("key")
  65. clear()
  66. exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement