Right now createButton(...) returns true once the button is created. It would be usefull if instead the function returned the button index, so you don't have to manually count the buttons.
Keep in mind that this could break scripts which use the bool returned.