Adding field to a form or a custom table is the same. It is the same principle.
Sure you can take a look at what happens inside CMS\CMSModules\CustomTables*.* and use reshaper to get to the bottom of it. Kinda crazy though.
The other way is create export package with test custom table. Look inside export package zip. There is an xml file with table schema , that describes your table. You need to generate such xml file. And use import api to create your table. Also not a very straight forward way.
Essentially in both cases it comes down to working with class xml schema.
P.S. You can always ask the support if they have such a script.