Advertisement
Guest User

list-peripheral-methods.lua

a guest
Mar 11th, 2022
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local args = {...}
  2. local sides = {}
  3.  
  4. if args[1] ~= nil then
  5.     sides[1] = args[1]
  6. else
  7.     sides = peripheral.getNames()
  8. end
  9.  
  10. local only1Peripheral = args[1] ~= nil or #sides == 1
  11.  
  12. for side in sides do
  13.      if not only1Peripheral then
  14.          print("Side " .. side .. ":")
  15.      end
  16.     for i, v in ipairs(peripheral.getMethods(side)) do
  17.         local startChar
  18.         if only1Peripheral then
  19.             startChar = ""
  20.         else
  21.             startChar = "\t"
  22.         end
  23.        
  24.         print(startChar .. i .. ": " .. v)
  25.     end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement