Stary2001

Untitled

Jan 5th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. rednet.open("right")
  2.  
  3. local client
  4.  
  5. function split(s)
  6. local t = {}
  7. for v in string.gmatch(s,"[^%s]+") do
  8. t[#t+1]=v
  9. end
  10. return t
  11. end
  12.  
  13. while true do
  14. local id,msg = rednet.receive()
  15. local cmd,args=string.gmatch(msg,"(.-) (.*)$")()
  16.  
  17. if args then
  18. args=split(args)
  19. print(args[1])
  20. ret = shell.run(cmd,unpack(args))
  21. else
  22. ret = shell.run(cmd)
  23. end
  24. rednet.send(id,tostring(ret))
  25. rednet.send(id,"end")
  26. end
  27.  
  28. rednet.close("right")
Advertisement
Add Comment
Please, Sign In to add comment