jerimo

CCRemote

Oct 11th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkTags(toCheck)
  2.   comon = 0
  3.   for i=1,#toCheck do
  4.     for o=1,#tags do
  5.       if tags[o] == toCheck[i] then
  6.         comon = comon + 1
  7.       end
  8.     end
  9.   end
  10.   if comon >= #toCheck then
  11.     return true
  12.   else
  13.     return false
  14.   end
  15. end
  16.  
  17. function checkUpdate()
  18.   local id, local func, local tags, local filename, local filedata = rednet.receive()
  19.   if type(tags) == "table" then
  20.     if checkTags(tags) then
  21.       if func == "Update" then
  22.         file = fs.open(filename, "w")
  23.         file.write(filedata)
  24.         file.close()
  25.       elseif func == "Delete" then
  26.         fs.delete(filename)
  27.       elseif func == "Shutdown" then
  28.         os.shutdown()
  29.       end
  30.     end
  31.   end
  32. end
  33.  
  34. while true do
  35.   checkUpdate()
  36. end
Advertisement
Add Comment
Please, Sign In to add comment