DrBurlao
May 22nd, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This script defines several functions for scanning directories and retrieving NBT files with their paths and sizes, displaying a paginated menu, and opening an NBT file. The main program uses these functions to create a file explorer-like interface.
  2.  
  3. Here's a concise summary of what the script does:
  4.  
  5. 1. The `scanFiles` function takes a directory path as input and recursively scans it for NBT files. It returns a table containing the paths and sizes of the NBT files found.
  6.  
  7. 2. The `showMenu` function takes a table of files, the current page number, and the page size as input. It displays a paginated menu showing the files' paths and sizes.
  8.  
  9. 3. The `openFile` function takes a file path as input and opens the file using the "nbt edit" command if it exists and is not a directory.
  10.  
  11. 4. The main program starts by scanning the root directory ("/") for NBT files and storing them in the `files` table. It sets the initial page number and page size.
  12.  
  13. 5. Inside the main loop, it shows the menu, prompts the user for input, and performs the corresponding action based on the input. If the input is "0", the program exits. If the input is a file number, it opens the corresponding file. If the input is "p" or "n", it navigates to the previous or next page, respectively. If the input is invalid, it displays an error message.
  14.  
  15. 6. After each action, the current page number is adjusted to wrap around if it exceeds the total number of pages.
  16.  
  17. That's a summary of the script's functionality. Let me know if you have any further questions!
Advertisement
Add Comment
Please, Sign In to add comment