Advertisement
MarcusTheGamer

uploadClient.lua

Feb 19th, 2025 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | Gaming | 0 0
  1. local data = ...
  2.  
  3. rednet.open("back")
  4. rednet.send(10,"","UPLOAD")
  5.  
  6. local senderId,message,protocol = rednet.receive("CONNECTED", 10)
  7.  
  8. if protocol == nil then
  9.     print("Error establishing connection to database")
  10. elseif protocol == "CONNECTED" then
  11.        
  12.     local file = fs.open(data .. ".lua", "r")
  13.  
  14.     local fileData = {data, file.readAll()}
  15.     file.close()
  16.  
  17.     rednet.send(senderId,fileData,"DATA")
  18.  
  19.     senderId,message,protocol = rednet.receive("SUCCESS", 10)
  20.  
  21.     if protocol == nil then
  22.         print("Upload status check timed out")
  23.     elseif protocol == "SUCCESS" then
  24.         print("File successfully uploaded to database")
  25.     end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement