Advertisement
MadManMarkAu

[CC] Peripheral Test

May 28th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local tPeripheralList
  2. local nPeripheralIndex
  3. local tPeripheralMethods
  4.  
  5. local tPeripheralList = peripheral.getNames()
  6.  
  7. print("Peripherals found on your system:")
  8. for nIndex = 1, #tPeripheralList do
  9.     print(tostring(nIndex) .. ": " .. peripheral.getType(tPeripheralList[nIndex]) .. " \"" .. tPeripheralList[nIndex] .. "\"")
  10. end
  11.  
  12. print()
  13. print("Enter peripheral number:")
  14. nPeripheralIndex = tonumber(read())
  15.  
  16. tPeripheralMethods = peripheral.getMethods(tPeripheralList[nPeripheralIndex])
  17.  
  18. print()
  19.  
  20. if tPeripheralMethods == nil then
  21.     print("Peripheral not found!")
  22. else
  23.     for nIndex = 1, #tPeripheralMethods do
  24.         print(tPeripheralMethods[nIndex])
  25.        
  26.         if nIndex - math.floor(nIndex / 15) * 15 == 0 then
  27.             print("[more] Press enter to continue...")
  28.             read()
  29.         end
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement