Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create go.lua to make robots move via the shell #398

Merged
merged 2 commits into from
Jul 14, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create go.lua
  • Loading branch information
Vexatos committed Jul 13, 2014
commit f7603f9a8ae9a7304edf0c4e86d62ec7abb989e0
Original file line number Diff line number Diff line change
@@ -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