mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 12:17:17 -04:00
Create go.lua
This commit is contained in:
parent
d84a899d4e
commit
f7603f9a8a
@ -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
|
Loading…
x
Reference in New Issue
Block a user