Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local logFile = "/.me_cells_log_tmp" -- Temporary file
- local device = peripheral.find("meBridge")
- if not device then
- print("No ME Bridge found!")
- return
- end
- local success, cells = pcall(device.listCells)
- if not success or type(cells) ~= "table" then
- print("Error: Unable to retrieve listCells()")
- return
- end
- local file = fs.open(logFile, "w")
- file.writeLine("ME Bridge - listCells() Output:\n")
- for slot, data in pairs(cells) do
- file.writeLine("Cell Slot: " .. tostring(slot))
- for key, value in pairs(data) do
- if type(value) == "table" then
- local success, serialized = pcall(textutils.serialize, value)
- if success then
- file.writeLine(" " .. key .. " = " .. serialized)
- else
- file.writeLine(" " .. key .. " = [Unserializable Data]")
- end
- else
- file.writeLine(" " .. key .. " = " .. tostring(value))
- end
- end
- file.writeLine("-------------------")
- end
- file.close()
- print("\nUploading to Pastebin...")
- local success = shell.run("pastebin", "put", logFile)
- if success then
- print("\nPastebin upload successful!")
- end
- fs.delete(logFile) -- Remove temporary file
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement