Add support for custom commands

First of all, great library.  This patch is a change to the library I made for a game project of my own, and I thought you may find it useful and/or worth consideration for inclusion.