replace dynamic_cast to std::is_base_of
Merge pull request #7532 from lite3/object_to_luaval

replace dynamic_cast to std::is_base_of