I'll see. I believe this is possible, but detecting the hammer in the slot is not possible as far as I know.
Maybe it is though.
Yeah the "attempt to call global exit" is semi intended as I don't know of any "exit()" methods that does the same, this is just to abort the program. It has no other side effects other than the error message.
What do you mean by "If there is empty space he wont go anywhere."
This is a better excavation program , you can adjust its parameters to excavate any cube.
Syntax: bdig [-luk] <up/down> <fwd> <side>
-l: makes the robot go left instead of right
-u: makes the robot go up instead of down
-k: not implemented yet
http://pastebin.com/KTS6CCk0
Get by typing `pastebin get KTS6CCk0 bdig.lua` in a robot (you need an Internet Card attached)
Examples:
bdig -u 10 10 10
Excavates a 10x10x10 cube (the robot is in the lower left corner)
Enjoy!