Create go.lua

This commit is contained in:
Vexatos 2014-07-13 19:29:25 +02:00
parent d84a899d4e
commit f7603f9a8a

View File

@ -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