DrFair

listen

Jan 24th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. rednet.open("right")
  2. items = {}
  3. amount = {}
  4. term.clear()
  5.  
  6. function update()
  7. term.clear()
  8. for i=1,#items do
  9. term.setCursorPos(1,i)
  10. term.write(items[i].." - "..tostring(amount[items[i]]))
  11. end
  12. end
  13.  
  14. function checkfor(str)
  15. exist = false
  16. for i=1,#items do
  17. if items[i] == str then
  18. exist = true
  19. end
  20. end
  21. if not exist then
  22. table.insert(items,str)
  23. end
  24. end
  25.  
  26. while true do
  27. event,id,message = os.pullEvent()
  28. if event == "rednet_message" then
  29. item = textutils.unserialize(message)
  30. checkfor(item[1])
  31. amount[item[1]] = item[2]
  32. update()
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment