diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp index 6ab96a2..1cf0c6e 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp @@ -11,6 +11,7 @@ static void DestructConstString(void* self) { ((ArbUt::StringView*)self)->~Strin static bool ConstStringEquality(const ArbUt::StringView& a, const ArbUt::StringView& b) { return a == b; } static bool ConstStringStdStringEquality(const ArbUt::StringView& a, const std::string& b) { return a == b; } static uint32_t ImplConstStringHashConv(const ArbUt::StringView& s) { return s.GetHash(); } +static std::string ImplConstStringStringConv(const ArbUt::StringView& s) { return std::string(s.std_str()); } void ConstStringRegister::Register(asIScriptEngine* engine) { auto r = engine->RegisterObjectType("constString", sizeof(ArbUt::StringView), @@ -52,4 +53,8 @@ void ConstStringRegister::Register(asIScriptEngine* engine) { asFUNCTIONPR(ImplConstStringHashConv, (const ArbUt::StringView&), uint32_t), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); + r = engine->RegisterObjectMethod("constString", "string opImplConv()", + asFUNCTIONPR(ImplConstStringStringConv, (const ArbUt::StringView&), std::string), + asCALL_CDECL_OBJFIRST); + Ensure(r >= 0); }