Advertisement
gravityio

dbapi

Dec 2nd, 2021 (edited)
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. local ws = {};
  2. local wss = {};
  3. local wso = {};
  4.  
  5. local JSON = {};
  6.  
  7. function JSON.toObj(data)
  8. return textutils.unserializeJSON(data);
  9. end
  10.  
  11. function wss.connect(ip)
  12. ws = http.websocket(ip);
  13. if (ws) then return wso end
  14. end
  15.  
  16. function wso:getFile(fileName)
  17. ws.send(fileName);
  18. local data = ws.receive();
  19. return JSON.toObj(data);
  20. end
  21.  
  22. return wss;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement