From 9f3771cea9f4a27eaec447ca0cd6a8c81cd5b3cd Mon Sep 17 00:00:00 2001 From: Zacharias Date: Tue, 6 May 2025 14:01:57 +0200 Subject: [PATCH] Fixed syntax error --- core.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core.lua b/core.lua index 3e55666..818ea30 100644 --- a/core.lua +++ b/core.lua @@ -43,19 +43,21 @@ function Core:read() if not self then error("No instance!") end - + if not self.ws then return false, "Websocket not initiated"; end - return true, textutils.unserialiseJSON(self.ws.receive()) + local data, success = self.ws.receive() + + return true, textutils.unserialiseJSON(data) end function Core:download(file) if not self then error("No instance!") end - + if not self.ws then return false, "Websocket not initiated"; end @@ -65,15 +67,15 @@ function Core:download(file) local success, data = self:read(); if not success then - return false, "Failed to read: "+data; + return false, "Failed to read: "..data; end if not data.type then - return false, "Invalid package: "+textutils.serialiseJSON(data); + return false, "Invalid package: "..textutils.serialiseJSON(data); end if not (data.type == "FILE_INFO") then - return false, "Invalid package type: "+textutils.serialiseJSON(data); + return false, "Invalid package type: "..textutils.serialiseJSON(data); end if not data.exists then @@ -85,15 +87,15 @@ function Core:download(file) local success, data = self:read(); if not success then - return false, "Failed to read: "+data; + return false, "Failed to read: "..data; end if not data.type then - return false, "Invalid package: "+textutils.serialiseJSON(data); + return false, "Invalid package: "..textutils.serialiseJSON(data); end if not data.type == "FILE_DATA" then - return false, "Invalid type: "+textutils.serialiseJSON(data) + return false, "Invalid type: "..textutils.serialiseJSON(data) end local fileStream = io.open(file, "w");