It's a small utility API which extends the native turtle functions with events.

Whenever you execute one of these turtle functions, it creates an event along with some additional information.
I used this primarily for my own purposes, but thought someone might get a use out of it as well.
http://en.wikipedia.org/wiki/WTFPL
Exposed Functions
forward() (or any other movement function)
- Event-Values: "turtle", "forward", < true | false > (where "forward" changes depeding on the move function you used)
- Return-Values: < true | false > (like the native function)
- Event-Values: "turtle", "select", < true | false >, < slot >
- Return-Values: < true | false > (like the native function)
- Event-Values: "turtle", "drop", < true | false >, < slot >, < dropped amount >
- Return-Values: < true | false >, < slot >, < dropped amount >
String
Boolean
Number
How to use?
- Save the API Code and make note of the filename, e.g. 'tev'
- Load the API within the program where you want to make use of it via os.loadAPI, e.g. os.loadAPI( "tev" )
- Then to call the API's functions just like the native turtle functions, but replace 'turtle' with 'tev', e.g.: tev.digDown()
- To listen to turtle events, create an event loop and pull four parameters from the event, e.g.:
local event, operation, success, slot, amount = os.pullEvent()
(See example program below for details)
API - Code
Pastebin: http://pastebin.com/tcNZNZyK
Direct-View:
Spoiler
Example Program to try out the API
Save the API from above as "tev".
Then run the program below. Pressing "e" will exit the program.
For all other keys see the code, there are quite a few. I mapped every turtle function to a key.
Pastebin: http://pastebin.com/mKsVVPFL
Direct-View:
Spoiler











