lua/api: fix object constructors to fail gracefully

8 jobs for master in 1 minute and 35 seconds (queued for 5 seconds)
latest
Status Name Job ID Coverage
  Container
passed container_fedora #13683778

00:00:20

passed container_ubuntu #13683779

00:00:20

 
  Build
passed build_on_fedora_no_docs #13683781

00:00:34

passed build_on_fedora_with_docs #13683780

00:00:57

passed build_on_ubuntu_no_gir #13683783

00:00:35

passed build_on_ubuntu_with_gir #13683782

00:00:52

 
  Pages
passed pages #13683784

00:00:16

 
  Deploy
passed pages:deploy

00:00:11