diff --git a/Controller/wheatController.lua b/Controller/CropController.lua similarity index 86% rename from Controller/wheatController.lua rename to Controller/CropController.lua index 999b9e4..559055b 100644 --- a/Controller/wheatController.lua +++ b/Controller/CropController.lua @@ -1,6 +1,6 @@ -wheatController = {} +CropController = {} -function wheatController:new(t) +function CropController:new(t) t = t or {} setmetatable(t, self) self.__index = self @@ -8,7 +8,7 @@ function wheatController:new(t) end -function toMatrix(str) +function CropController:toMatrix(str) local matrix = {} assert(type(str) == "string") assert(str:sub(1,1) == "{", "the string must begin with a \"{\"") @@ -44,7 +44,7 @@ function toMatrix(str) end -function toArray(str) +function CropController:toArray(str) local len = str:len() local comma = str:find(",") local arr = {} @@ -60,13 +60,13 @@ function toArray(str) return arr end -function wheatController:sendMessage(id, message, protocol) +function CropController:sendMessage(id, message, protocol) rednet.send(id, message, protocol) local id2, message2 = rednet.receive("received", 1) return message == message2 end -function wheatController:doAction(id, message, protocol) +function CropController:doAction(id, message, protocol) self:sendMessage(id, message, protocol) local id2, message2, protocol2 repeat @@ -75,6 +75,6 @@ function wheatController:doAction(id, message, protocol) return protocol2 == "confirm", message2 end -function wheatController:setSlaveID(id) +function CropController:setSlaveID(id) self.slaveID = id end \ No newline at end of file