Perhaps if omitted and the code-block has an id and the table has a caption, use the id of the code-block. When the table has no caption the function should give a warning and ignore the request to add a label.