Advertisement
YiraSan

Lillay (Computer Craft)

Jul 5th, 2022 (edited)
921
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None
  1. function castPeripheral(side, typ)
  2.      if peripheral.isPresent(side) == false then
  3.         error("No "..side.." peripheral found!")
  4.      elseif peripheral.getType(side) == typ then
  5.         return peripheral.wrap(side)
  6.      else
  7.         error("Peripheral at "..side.." side is not a "..typ)
  8.      end
  9. end
  10.  
  11. function findPeripheral(typ)
  12.     local p = peripheral.find(typ)
  13.     if p == nil then
  14.         error("No peripheral found")
  15.     end
  16. end
  17.  
  18. print(findPeripheral("monitor"))
Advertisement
RAW Paste Data Copied
Advertisement