Cavious

api_updaterServer

Jun 20th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. --[[
  2. FILENAME: api_updaterServer.lua(API)
  3. AUTHOR: Donald R. Valverde (Cavious)
  4. VERSION: 1.0-ALPHA
  5. --]]
  6. function send(id)
  7.     local fileList = fs.list("/gb_os")
  8.     local packet = {}
  9.     local i = 2
  10.  
  11.     local getFile = fs.open("getFile", "w")
  12.  
  13.     for _, file in ipairs(fileList) do
  14.         newDir = fs.getDir(file)
  15.         getFile.writeLine(newDir)
  16.     end
  17.  
  18.     getFile.close()
  19.  
  20.     for _, file in ipairs(fileList) do
  21.         local curFile = fs.open(file, "r")
  22.         packet[i] = curFile
  23.         curFile.close()
  24.         i = i + 1
  25.     end
  26.  
  27.     textutils.serialize(packet)
  28.     rednet.send(id, packet)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment