Advertisement
Lyandro

bau_monitorado

Sep 16th, 2023 (edited)
1,049
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | Gaming | 0 0
  1. rednet.open("bottom")
  2. local chest = peripheral.wrap("right")
  3. local qtd = 0
  4.  
  5. while true do
  6.     local sender, message, protocol = rednet.receive("bau1")
  7.  
  8.     if message == "count" then
  9.         lista = chest.list()
  10.         range = #lista
  11.  
  12.         qtd_1 = 0
  13.         for i = 1, range, 1 do
  14.             qtd_1 = qtd_1 + (lista[i].count)
  15.         end
  16.  
  17.         print(qtd_1)
  18.  
  19.         rednet.broadcast(qtd_1, "qtd_1")
  20.  
  21.     end
  22. end
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement