Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Lists all components attached to the computer, followed by their OpenPeripherals API. Press any key to cycle to the next component.
- local component = require("component")
- local event = require("event")
- local function findComps(type)
- local comps = {}
- local compNames = {}
- for cAddress,cType in component.list(type) do
- -- Insert proxy methods table into comps table
- table.insert(comps, component.proxy(cAddress))
- -- Insert component type into compNames table
- table.insert(compNames, cType)
- end
- return comps, compNames
- end
- local comps, compNames = findComps()
- for i=1, #comps do -- Iterate components
- print("\n"..compNames[i]..":")
- for k,v in pairs(comps[i]) do -- Iterate methods
- print(k) -- Print method name
- end
- print(" ")
- os.sleep(0.2)
- print("Press any key to continue")
- local _,_ = event.pull("key")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement