Advertisement
Guest User

sign

a guest
May 27th, 2018
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. function peripheral.find(pType)
  2.   pList = {}
  3.   for _,pName in pairs(peripheral.getNames()) do
  4.     if peripheral.getType(pName) == pType then
  5.       table.insert(pList, peripheral.wrap(pName))
  6.     end
  7.   end
  8.   return unpack(pList)
  9. end
  10.  
  11. local colorSymbol = ""
  12.  
  13. file = fs.open("colorSymbol","wb")
  14. file.write(194)
  15. file.write(167)
  16. file.close()
  17.  
  18. file = fs.open("colorSymbol", "r")
  19. colorSymbol = file.readAll()
  20. file.close()
  21.  
  22. local sign = peripheral.find("sign")
  23.  
  24. args = {...}
  25.  
  26. if args[1] and args[2] and tonumber(args[1]) then  
  27.   local line = tonumber(args[1])
  28.   local text = ""
  29.  
  30.   for i=2, #args, 1 do
  31.     text = text .. args[i]
  32.     if args[i+1] then
  33.        text = text .. " "
  34.     end
  35.   end
  36.  
  37.   text = text:gsub("&", colorSymbol)
  38.   sign.setLine(line,text)
  39.   return
  40. end
  41.  
  42. print("Usage: sign <line> <text>")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement