From edcab83d4e5a495e8a75880c3d41670a271f455d Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 26 May 2024 01:35:12 +0200 Subject: [PATCH] feat(robot): add turnBack method --- libs/robot.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/robot.lua b/libs/robot.lua index 05794f5..a10a183 100644 --- a/libs/robot.lua +++ b/libs/robot.lua @@ -200,6 +200,16 @@ api.create = function(state, givenConfig) return ok, err end + robot.turnBack = function() + local ok, errorMessage = robot.turnLeft() + + if not ok then + error('turnBack: cannot turn left because ' .. tostring(errorMessage)) + end + + return robot.turnLeft() + end + robot.getState = function() return state end