666WTF666

hs 3

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