Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Blockly source: http://blockly-lua.appspot.com/static/apps/code/index.html#w5yeux
- function create_wall(instructions)
- for _, row in ipairs(instructions) do
- for _, slot_number in ipairs(row) do
- if not turtle.select(slot_number) then
- return 'Unable to select slot #' .. slot_number
- end
- if not turtle.place() then
- return 'Unable to place item from slot #' .. slot_number
- end
- turtle.turnRight()
- if not turtle.forward() then
- return 'Unable to move forward.'
- end
- turtle.turnLeft()
- end
- turtle.turnRight()
- for count = 1, math.floor(#row) do
- if not turtle.back() then
- return 'Unable to move backward.'
- end
- end
- turtle.turnLeft()
- if not turtle.up() then
- return 'Unable to move up.'
- end
- end
- for count2 = 1, math.floor(#instructions) do
- if not turtle.down() then
- return 'Unable to move backward.'
- end
- end
- return 'Done.'
- end
- print(create_wall(({({1, 2, 1, 2, 1}), ({2, 1, 2, 1, 2})})))
Advertisement
Add Comment
Please, Sign In to add comment