Advertisement
Guest User

run

a guest
Sep 3rd, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.40 KB | None | 0 0
  1. local server = "localhost:3000"
  2. local fetchPath = "http://"..server.."/fetch"
  3.  
  4. function poll()
  5.   local fetched = http.get(fetchPath)
  6.   local data = fetched.readAll()
  7.   if data == nil or data == '' then
  8.   else
  9.     print "Got a program!"
  10.     print "Executing..."
  11.     local func = loadstring(data)
  12.     func()
  13.     print "Done."
  14.   end
  15. end
  16.  
  17. while true do
  18.   print "."
  19.   poll()
  20.   os.sleep(1)
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement