replaced manual error message with lual_checktype

Resolves #4