Some code I wrote for a mod for Minecraft called Computer Craft. Take note of "atn" and "consume".