Advertisement
Loneranger419

makeLog

Feb 1st, 2025 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | Source Code | 0 0
  1. local logFile = "me_items_log.txt"
  2. local device = peripheral.find("meBridge")
  3.  
  4. if not device then
  5.     print("No ME Bridge found!")
  6.     return
  7. end
  8.  
  9. local file = fs.open(logFile, "w")
  10. file.writeLine("ME Bridge - listItems() Output:\n")
  11.  
  12. local success, items = pcall(device.listItems)
  13.  
  14. if success and type(items) == "table" then
  15.     for slot, data in pairs(items) do
  16.         file.writeLine("Slot: " .. tostring(slot))
  17.  
  18.         for key, value in pairs(data) do
  19.             if type(value) == "table" then
  20.                 file.writeLine("  " .. key .. " = [TABLE]")
  21.             else
  22.                 file.writeLine("  " .. key .. " = " .. tostring(value))
  23.             end
  24.         end
  25.     end
  26. else
  27.     file.writeLine("Error: Unable to retrieve listItems()")
  28. end
  29.  
  30. file.close()
  31. print("\nItem log saved to " .. logFile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement