666WTF666

tescik

Jun 3rd, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. opcje = {}
  2. wybor = 1
  3. opcje[1] = "Otworz Brame"
  4. opcje[2] = "Zamknij Brame"
  5. opcje[3] = "Reset"
  6.  
  7. function uruchom(numer)
  8. if numer == 1 then
  9. os.run("rs")
  10. elseif numer == 2 then
  11. os.run("rs2")
  12. sleep(3)
  13. if numer == 3 then
  14. os.run("reboot")
  15.  
  16. wybor = 1
  17. return menu()
  18. end
  19. end
  20.  
  21. function przycisk()
  22. sleep(0.05)
  23. event, argument = os.pullEvent()
  24. if event == "key" then
  25. if argument == 28 then
  26. return uruchom(wybor)
  27. elseif argument == 200 then
  28. if wybor == 1 then
  29. else
  30. wybor = wybor - 1
  31. end
  32. elseif argument == 208 then
  33. if wybor == table.getn(opcje) then
  34. else
  35. wybor = wybor + 1
  36. end
  37. else
  38. return przycisk()
  39. end
  40. else
  41. return przycisk()
  42. end
  43. return menu()
  44. end
  45.  
  46. function menu()
  47. shell.run("clear")
  48. for i=1, table.getn(opcje) do
  49. if wybor == i then
  50. print("[ "..opcje[i].." ]")
  51. else
  52. print(opcje[i])
  53. end
  54. end
  55. return przycisk()
  56. end
  57.  
  58. shell.run("clear")
  59. return menu()
Advertisement
Add Comment
Please, Sign In to add comment