As a note, your invocation error seems to be more related to passing a null value. I did not get the same error you are reporting.
However, I strongly suggest that you use Portable Infoboxes rather than Lua InfoboxBuilder, which is no longer supported. Additionally, the function you are building in Lua is native to Portable Infoboxes.
Thank you for the reply. Up until a little while ago I was against using PI, thinking source edit mode was not available in it. (It might be helpful if somebody could add some lines on w:c:portability:Help:PortableInfoboxes about how to switch between Builder and Source mode.) That switch button was lurking in the right bottom corner...
Why not using PI knowing that I have good control of the markup? Time to give it a taste.