Guest User

Untitled

a guest
May 26th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. -- FILE MANAGER (C) lego11 2020 - An ATARI GEM Product
  2. local basedir = "/data"
  3.  
  4. function clear()
  5. term.clear()
  6. term.setCursorPos(1, 1)
  7. end
  8.  
  9. function colore(colore)
  10. term.setTextColor(colore)
  11. end
  12. function sfondo(colore)
  13. term.setBackgroundColor(colore)
  14. end
  15.  
  16. function lista_dir(dir)
  17. local tab_f = fs.list(dir)
  18. sfondo(colors.black)
  19. local x = 2
  20. local y = 3
  21. if dir ~= "/" then
  22. term.setCursorPos(x, y)
  23. sfondo(colors.yellow)
  24. colore(colors.red)
  25. term.write("Liv. sup.")
  26. sfondo(colors.black)
  27.  
  28. end
  29. for key, value in ipairs(tab_f) do
  30. if fs.isDir(value) == true then
  31. term.setCursorPos(x, y)
  32. sfondo(colors.yellow)
  33. colore(colors.green)
  34. y = y + 2
  35. term.setCursorPos(x, y)
  36. term.write(value)
  37. sfondo(colors.black)
  38. else
  39. term.setCursorPos(x, y)
  40. sfondo(colors.yellow)
  41. colore(colors.blue)
  42. y = y + 2
  43. term.setCursorPos(x, y)
  44. term.write(value)
  45. sfondo(colors.black)
  46. end
  47. if y > 10 then
  48. x = 13
  49. y = 3
  50. end
  51. end
  52. end
  53. clear()
  54. sfondo(colors.gray)
  55. colore(colors.white)
  56. print("Menu FILE MANAGER Esci")
  57. lista_dir("/data/")
  58. term.setCursorPos(20, 20)
Advertisement
Add Comment
Please, Sign In to add comment