Advertisement
BlueMond

GlassChat

Jan 1st, 2014
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local max = 10
  2. local test = peripheral.wrap("right")
  3. local pTable = {}
  4. local Users = {}
  5. test.clear()
  6.  
  7. function addMessage(sender, message)
  8.         if #pTable < max then
  9.                 print("test")
  10.                 pTable[#pTable+1] = test.addText(1, (#pTable+1)*10, pl..": "..com, colors.blue)
  11.         else
  12.                 for x=1, #pTable-1 do
  13.                         pTable[x].setText(pTable[x+1].getText())
  14.                 end
  15.                
  16.                 pTable[max].setText(pl..": "..com)
  17.         end
  18.         print(pl..": "..com)
  19. end
  20.  
  21. while true do
  22.         e, side, pl, p1, com = os.pullEvent("glasses_chat_command")
  23.         --if com == "#clear" then
  24.                 --os.reboot()
  25.         --end
  26.         --if com == "#hist" then
  27.                 --local list = ""
  28.                 --for x=1,#Users do
  29.                         --list = list..Users[x].." "
  30.                 --end
  31.                 --addMessage("Terminal",list)
  32.         --else
  33.                 addMessage(pl, com)
  34.                 --table.insert(Users, pl)
  35.         --end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement