MCPcopy Create free account
hub / github.com/OpenMW/openmw / formatCastingError

Method formatCastingError

components/lua/luastate.cpp:460–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458 }
459
460 std::string Internal::formatCastingError(const sol::object& obj, const std::type_info& t)
461 {
462 const char* typeName = t.name();
463 if (t == typeid(int))
464 typeName = "int";
465 else if (t == typeid(unsigned))
466 typeName = "uint32";
467 else if (t == typeid(size_t))
468 typeName = "size_t";
469 else if (t == typeid(float))
470 typeName = "float";
471 else if (t == typeid(double))
472 typeName = "double";
473 else if (t == typeid(sol::table))
474 typeName = "sol::table";
475 else if (t == typeid(sol::function) || t == typeid(sol::protected_function))
476 typeName = "sol::function";
477 else if (t == typeid(std::string) || t == typeid(std::string_view))
478 typeName = "string";
479 return std::string("Value \"") + toString(obj) + std::string("\" can not be casted to ") + typeName;
480 }
481}

Callers

nothing calls this directly

Calls 2

nameMethod · 0.80
toStringFunction · 0.70

Tested by

no test coverage detected