Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CC:Tweaked Peripheral Method Inspector
- -- Wraps the bottom peripheral and writes all methods to m.txt
- -- Check if there's a peripheral on the bottom
- local bottomPeripheral = peripheral.wrap("bottom")
- if not bottomPeripheral then
- print("Error: No peripheral found on the bottom side")
- return
- end
- -- Get the peripheral type for informational purposes
- local peripheralType = peripheral.getType("bottom")
- print("Found peripheral: " .. peripheralType)
- -- Get all methods from the peripheral
- local methods = peripheral.getMethods("bottom")
- if not methods or #methods == 0 then
- print("Error: No methods found for the bottom peripheral")
- return
- end
- -- Sort methods alphabetically for better organization
- table.sort(methods)
- -- Open file for writing
- local file = fs.open("m.txt", "w")
- if not file then
- print("Error: Could not create m.txt file")
- return
- end
- -- Write header information
- file.writeLine("Peripheral Methods for: " .. peripheralType)
- file.writeLine("Location: bottom")
- file.writeLine("Total methods: " .. #methods)
- file.writeLine(string.rep("-", 40))
- file.writeLine("")
- -- Write each method to the file
- for i, method in ipairs(methods) do
- file.writeLine(i .. ". " .. method)
- end
- -- Close the file
- file.close()
- print("Successfully wrote " .. #methods .. " methods to m.txt")
- print("Methods from " .. peripheralType .. " peripheral have been saved!")
- -- Optional: Display first few methods on screen
- print("\nFirst few methods:")
- for i = 1, math.min(5, #methods) do
- print(" " .. methods[i])
- end
- if #methods > 5 then
- print(" ... and " .. (#methods - 5) .. " more (see m.txt for full list)")
- end
Advertisement
Add Comment
Please, Sign In to add comment