Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local location = tostring(tArgs[1]) or nil
- local directory = "Peripherals"
- local sides = {["front"] = true, ["back"] = true, ["left"] = true, ["right"] = true, ["top"] = true, ["bottom"] = true}
- if location == nil or not sides[location] then
- error("Use: " .. shell.getRunningProgram() .. " <Valid side", 0)
- elseif not peripheral.isPresent(location) then
- error("Pheripheral isn't found, check side", 0)
- end
- function source(command)
- return peripheral.call(location, command)
- end
- local type = source("getType")
- if not (local methods = source("getMethods")) then
- error("Command <getmethods> failed", 1)
- end
- if not fs.isDir(directory) then
- fs.makeDir(directory)
- end
- if not fs.exsists(directory, "/", type) then
- output = io.open(directory .. "/" .. type, 'w')
- output:write("Savage_Me55iah's Peripheral aid for")
- output:write("\n")
- output:write("Peripheral Type: " .. type)
- output:write("\n")
- output:write("\n")
- output:write("List of methods: ")
- for k,v in pairs(methods) do
- output:write("\n")
- output:write(k .. ": " .. v)
- end
- output:close()
- else
- error("List already exsists, to view type: edit " .. directory .. "/" .. type, 0)
- end
- print("To view list anytime type: edit " .. directory .. "/" .. type)
- print("Thank you for using Savage_Me55iah's Peripheral Aid")
Advertisement
Add Comment
Please, Sign In to add comment