Sometimes Lua module is used with some obsolete parameters, and wants to create a category for all pages that use it in obsolete way. Other times Lua might simply want to add a category to the page. Regardless, adding "[[category:xxx]]" to the output is not ideal because there are many cases when it breaks final wiki markup (e.g. in the middle of the html atribute text.
I think there should be a frame::addCategory()