Following this article http://www.angelcode.com/angelscript/sdk/docs/manual/doc_adv_inheritappclass.html
When you got an instance in the script side of FooScripted it creates an instance of FooScripted_t in the C++ side and let you define the opImplCast this way:
// The script class can be implicitly cast to the C++ type through the opImplCast method
FooScripted_t @opImplCast() { return m_obj; }
Is it possible to cast the other way round? I've a function that recieves a FooScripted_t from C++ and want to cast it to the FooScripted type. In the C++ type you got the pointer to the asIScriptObject, so I've try to manually define this with a refCast function that pass the asIScriptObject
engine->RegisterObjectMethod("FooScripted_t", "FooScripted@ opImplCast()", AngelScript::asFUNCTION(refCast), AngelScript::asCALL_CDECL_OBJLAST);
But is not possible because FooScripted 'is not a data type in a global namespace' since its defined in a script file I think. Any way to fix this? Thanks