From f7603f9a8ae9a7304edf0c4e86d62ec7abb989e0 Mon Sep 17 00:00:00 2001 From: Vexatos Date: Sun, 13 Jul 2014 19:29:25 +0200 Subject: [PATCH] Create go.lua --- .../lua/component/robot/bin/go.lua | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/main/resources/assets/opencomputers/lua/component/robot/bin/go.lua diff --git a/src/main/resources/assets/opencomputers/lua/component/robot/bin/go.lua b/src/main/resources/assets/opencomputers/lua/component/robot/bin/go.lua new file mode 100644 index 000000000..86f8df29a --- /dev/null +++ b/src/main/resources/assets/opencomputers/lua/component/robot/bin/go.lua @@ -0,0 +1,23 @@ +local robot=require("robot") +local shell=require("shell") +local args = shell.parse(...) +if #args<1 then + io.stderr:write("No direction specified\n") + return +end +if args[1] == "forward" then + robot.forward() +elseif args[1] == "back" then + robot.back() +elseif args[1]=="left" then + robot.turnLeft() +elseif args[1]=="right" then + robot.turnRight() +elseif args[1]=="up" then + robot.up() +elseif args[1]=="down" then + robot.down() +else + io.stderr:write(args[1]..": not a valid direction!\n") + return +end