Advertisement
maxthewell

invServer.lua

Aug 22nd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. os.loadAPI("lib/net.lua")
  2.  
  3. PROTO = "INV"
  4. HOST_NAME = "inv-mgmt-01"
  5. CUE = "get"
  6. INPUT_SIDE = "top"
  7.  
  8. function serve()
  9.     while(true) do
  10.         clientID, msg = net.listen(PROTO)
  11.         if msg == CUE then
  12.             msg = rs.getBundledInput(INPUT_SIDE)
  13.             -- give the client time to listen
  14.             os.sleep(2)
  15.             rednet.send(clientID, msg, PROTO)
  16.         end
  17.     end
  18. end
  19.  
  20.  
  21. -- setup
  22. print("initializing inventory server...")
  23. net.connect()
  24. rednet.host(PROTO, HOST_NAME)
  25. serve()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement