Advertisement
PolskiWisnia

Untitled

Aug 15th, 2023 (edited)
850
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. -- Microcraft Market -- Based on Microcraft NExplorer API --
  2.  
  3. local function s(...) return sleep(...) end
  4. local function aw(...) return write(...) end
  5. local function p(...) return print(...) end
  6. local function tw(...) return term.write(...) end
  7. local function scp(...) return term.setCursorPos(...) end
  8. local function sbc(...) return term.setBackgroundColor(...) end
  9. local function stc(...) return term.setTextColor(...) end
  10. local function tc(...) return term.clear(...) end
  11. local function tcl(...) return term.clearLine(...) end
  12. local function r(...) return shell.run(...) end
  13. local function sp(...) return textutils.slowPrint(...) end
  14. local function sw(...) return textutils.slowWrite(...) end
  15. local function fse(...) return fs.exists(...) end
  16. local function pul(...) return paintutils.loadImage(...) end
  17. local function pud(...) return paintutils.drawImage(...) end
  18. local function pfb(...) return paintutils.drawFilledBox(...) end
  19. local function su(...) return os.shutdown(...) end
  20. local function re(...) return os.reboot(...) end
  21. local function pdp(...) return paintutils.drawPixel(...) end
  22.  
  23. w,h = term.getSize()
  24.  
  25. function pliki(sciezka)
  26. arg = {}
  27. local files = fs.list(sciezka)
  28. y = 1
  29. for i,file in ipairs(files) do
  30.     arg[y] = file
  31.     y = y+1
  32. end
  33. a = 1
  34. scp(1,10)
  35. arg[y+1] = y
  36. return arg
  37. end
  38.  
  39. function ile_plikow(sciezka)
  40. local files = fs.list(sciezka)
  41. ile = 0
  42. for i,file in ipairs(files) do
  43.     ile = ile+1
  44. end
  45. return ile
  46. end
  47.  
  48. function wyswietl_pliki()
  49.     sbc(colors.black)
  50.     tc()
  51.     sbc(colors.black)
  52.     stc(colors.white)
  53.     pfb(1,1,w,1,colors.blue)
  54.     stc(colors.white)
  55.     scp(1,1)
  56.     p("Microcraft Market")
  57.     sbc(colors.black)
  58.     local files = fs.list("/listings/")
  59.     x = 2
  60.     y = 3
  61.     loop = 0
  62.     for i,file in ipairs(files) do
  63.         if y<h-2 then
  64.             scp(x+5*loop,y)
  65.             if not fs.isDir(file) then
  66.                 term.write(file)
  67.             end
  68.         else
  69.             y = 3
  70.             loop = loop+1
  71.         end
  72.         y = y+1
  73.     end
  74. end
  75.  
  76. wyswietl_pliki()
  77. s(3)
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement