Replace std::is_base_of with dynamic_cast used in the object_to_luaval