luaa: check that object is a table before calling lua_next()